Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Birb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gadig
Birb
Commits
1fafa54d
Commit
1fafa54d
authored
Apr 10, 2017
by
Cethin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drag Placement nearly working.
Dragging right works. Dragging up broken. Others unemplemented.
parent
0a52735a
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
428 additions
and
23 deletions
+428
-23
Assets/Prefabs/Player.prefab
Assets/Prefabs/Player.prefab
+17
-0
Assets/Prefabs/Tiles/Hazards/Thorns.prefab
Assets/Prefabs/Tiles/Hazards/Thorns.prefab
+91
-0
Assets/Prefabs/Tiles/Hazards/Thorns.prefab.meta
Assets/Prefabs/Tiles/Hazards/Thorns.prefab.meta
+8
-0
Assets/Scenes/LargeLevelTest.unity
Assets/Scenes/LargeLevelTest.unity
+0
-0
Assets/Scenes/LargeLevelTest.unity.meta
Assets/Scenes/LargeLevelTest.unity.meta
+0
-0
Assets/Scenes/_BASE_LEVEL_.unity
Assets/Scenes/_BASE_LEVEL_.unity
+106
-0
Assets/Scripts/MapEditor/DragPlaceInfo.cs
Assets/Scripts/MapEditor/DragPlaceInfo.cs
+9
-0
Assets/Scripts/MapEditor/DragPlaceInfo.cs.meta
Assets/Scripts/MapEditor/DragPlaceInfo.cs.meta
+12
-0
Assets/Scripts/MapEditor/DragPlacement.cs
Assets/Scripts/MapEditor/DragPlacement.cs
+105
-0
Assets/Scripts/MapEditor/DragPlacement.cs.meta
Assets/Scripts/MapEditor/DragPlacement.cs.meta
+12
-0
Assets/Scripts/MapEditor/MapEditor.cs
Assets/Scripts/MapEditor/MapEditor.cs
+63
-18
Assets/Scripts/MapEditor/World.cs
Assets/Scripts/MapEditor/World.cs
+2
-2
Assets/Scripts/Player/CameraFollow.cs
Assets/Scripts/Player/CameraFollow.cs
+3
-3
No files found.
Assets/Prefabs/Player.prefab
View file @
1fafa54d
...
...
@@ -296,6 +296,7 @@ GameObject:
-
component
:
{
fileID
:
114296284101528218
}
-
component
:
{
fileID
:
114496983445290320
}
-
component
:
{
fileID
:
114468523229820794
}
-
component
:
{
fileID
:
114201504414302498
}
m_Layer
:
8
m_Name
:
Player
m_TagString
:
Player
...
...
@@ -943,6 +944,22 @@ MonoBehaviour:
buttons
:
5
condition
:
0
inputState
:
{
fileID
:
114343537035820548
}
---
!u!114
&114201504414302498
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1784255690954616
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
0cad1638cf0899c4584bad64f0af5112
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
smoothSpeed
:
1
UpBuffer
:
5
DownBuffer
:
5
RightBuffer
:
5
LeftBuffer
:
5
---
!u!114
&114296284101528218
MonoBehaviour
:
m_ObjectHideFlags
:
1
...
...
Assets/Prefabs/Tiles/Hazards/Thorns.prefab
0 → 100644
View file @
1fafa54d
%YAML
1.1
%TAG
!u!
tag:unity3d.com,2011:
---
!u!1001
&100100000
Prefab
:
m_ObjectHideFlags
:
1
serializedVersion
:
2
m_Modification
:
m_TransformParent
:
{
fileID
:
0
}
m_Modifications
:
[]
m_RemovedComponents
:
[]
m_ParentPrefab
:
{
fileID
:
0
}
m_RootGameObject
:
{
fileID
:
1813104308667434
}
m_IsPrefabParent
:
1
---
!u!1
&1813104308667434
GameObject
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
5
m_Component
:
-
component
:
{
fileID
:
4564406416464228
}
-
component
:
{
fileID
:
212266651003183348
}
-
component
:
{
fileID
:
114415704360927376
}
m_Layer
:
0
m_Name
:
Thorns
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!4
&4564406416464228
Transform
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1813104308667434
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
7.864797
,
y
:
2.9603853
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&114415704360927376
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1813104308667434
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
970b431072fe5634784b9b17fb23c868
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
cap
:
{
fileID
:
1377815954954446
,
guid
:
86f22dcaff0608e47a1358b04e30bc16
,
type
:
2
}
mid
:
{
fileID
:
1571230098110790
,
guid
:
d416bcc245ee5024fb9496336aa10eec
,
type
:
2
}
---
!u!212
&212266651003183348
SpriteRenderer
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1813104308667434
}
m_Enabled
:
1
m_CastShadows
:
0
m_ReceiveShadows
:
0
m_MotionVectors
:
1
m_LightProbeUsage
:
0
m_ReflectionProbeUsage
:
0
m_Materials
:
-
{
fileID
:
10754
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
m_StaticBatchInfo
:
firstSubMesh
:
0
subMeshCount
:
0
m_StaticBatchRoot
:
{
fileID
:
0
}
m_ProbeAnchor
:
{
fileID
:
0
}
m_LightProbeVolumeOverride
:
{
fileID
:
0
}
m_ScaleInLightmap
:
1
m_PreserveUVs
:
0
m_IgnoreNormalsForChartDetection
:
0
m_ImportantGI
:
0
m_SelectedEditorRenderState
:
0
m_MinimumChartSize
:
4
m_AutoUVMaxDistance
:
0.5
m_AutoUVMaxAngle
:
89
m_LightmapParameters
:
{
fileID
:
0
}
m_SortingLayerID
:
0
m_SortingOrder
:
0
m_Sprite
:
{
fileID
:
21300000
,
guid
:
4a1f3689072928c45a56412b16325f14
,
type
:
3
}
m_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
m_FlipX
:
0
m_FlipY
:
0
Assets/Prefabs/Tiles/Hazards/Thorns.prefab.meta
0 → 100644
View file @
1fafa54d
fileFormatVersion: 2
guid: 542fefc006c5d4b43be9ea95fea05e02
timeCreated: 1491773148
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
Assets/LargeLevelTest.unity
→
Assets/
Scenes/
LargeLevelTest.unity
View file @
1fafa54d
File moved
Assets/LargeLevelTest.unity.meta
→
Assets/
Scenes/
LargeLevelTest.unity.meta
View file @
1fafa54d
File moved
Assets/Scenes/_BASE_LEVEL_.unity
View file @
1fafa54d
...
...
@@ -196,6 +196,112 @@ Prefab:
m_RemovedComponents
:
[]
m_ParentPrefab
:
{
fileID
:
100100000
,
guid
:
8c5d1c74f70f3894abe80d24323d2df5
,
type
:
2
}
m_IsPrefabParent
:
0
---
!u!1
&763200278
GameObject
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
serializedVersion
:
5
m_Component
:
-
component
:
{
fileID
:
763200279
}
m_Layer
:
0
m_Name
:
Tiles
m_TagString
:
Tiles Parent
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!4
&763200279
Transform
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
763200278
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
3
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!1
&1040622841
GameObject
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
serializedVersion
:
5
m_Component
:
-
component
:
{
fileID
:
1040622844
}
-
component
:
{
fileID
:
1040622843
}
-
component
:
{
fileID
:
1040622842
}
m_Layer
:
0
m_Name
:
New Sprite
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&1040622842
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1040622841
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
970b431072fe5634784b9b17fb23c868
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
cap
:
{
fileID
:
1377815954954446
,
guid
:
86f22dcaff0608e47a1358b04e30bc16
,
type
:
2
}
mid
:
{
fileID
:
1571230098110790
,
guid
:
d416bcc245ee5024fb9496336aa10eec
,
type
:
2
}
---
!u!212
&1040622843
SpriteRenderer
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1040622841
}
m_Enabled
:
1
m_CastShadows
:
0
m_ReceiveShadows
:
0
m_MotionVectors
:
1
m_LightProbeUsage
:
0
m_ReflectionProbeUsage
:
0
m_Materials
:
-
{
fileID
:
10754
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
m_StaticBatchInfo
:
firstSubMesh
:
0
subMeshCount
:
0
m_StaticBatchRoot
:
{
fileID
:
0
}
m_ProbeAnchor
:
{
fileID
:
0
}
m_LightProbeVolumeOverride
:
{
fileID
:
0
}
m_ScaleInLightmap
:
1
m_PreserveUVs
:
0
m_IgnoreNormalsForChartDetection
:
0
m_ImportantGI
:
0
m_SelectedEditorRenderState
:
0
m_MinimumChartSize
:
4
m_AutoUVMaxDistance
:
0.5
m_AutoUVMaxAngle
:
89
m_LightmapParameters
:
{
fileID
:
0
}
m_SortingLayerID
:
0
m_SortingOrder
:
0
m_Sprite
:
{
fileID
:
21300000
,
guid
:
4a1f3689072928c45a56412b16325f14
,
type
:
3
}
m_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
m_FlipX
:
0
m_FlipY
:
0
---
!u!4
&1040622844
Transform
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1040622841
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
7.864797
,
y
:
2.9603853
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
4
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!1
&1100797466
GameObject
:
m_ObjectHideFlags
:
0
...
...
Assets/Scripts/MapEditor/DragPlaceInfo.cs
0 → 100644
View file @
1fafa54d
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
DragPlaceInfo
:
MonoBehaviour
{
public
GameObject
cap
;
public
GameObject
mid
;
}
Assets/Scripts/MapEditor/DragPlaceInfo.cs.meta
0 → 100644
View file @
1fafa54d
fileFormatVersion: 2
guid: 970b431072fe5634784b9b17fb23c868
timeCreated: 1491770342
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/MapEditor/DragPlacement.cs
0 → 100644
View file @
1fafa54d
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
static
class
DragPlacement
{
private
static
Vector2
start
=
new
Vector2
(
float
.
MinValue
,
float
.
MinValue
);
public
static
DragPlaceInfo
info
;
public
static
bool
running
()
{
return
World
.
posInBounds
(
start
);
}
public
static
void
startDrag
(
Vector2
s
,
DragPlaceInfo
i
)
{
Debug
.
Log
(
string
.
Format
(
"startDrag({0},)"
,
s
));
if
(
World
.
posInBounds
(
s
))
{
start
=
s
;
info
=
i
;
}
}
public
static
void
endDrag
()
{
Vector2
s
=
startPos
();
start
=
new
Vector2
(
float
.
MinValue
,
float
.
MinValue
);
Vector2
e
=
endPos
(
s
,
MapEditor
.
MousePosition
);
if
(!
World
.
posInBounds
(
e
))
{
e
.
x
=
World
.
Width
;
e
.
y
=
s
.
y
;
}
//Debug.DrawLine(s, e, Color.blue, 1f);
if
(
e
.
x
>
s
.
x
)
{
placeRight
(
s
,
e
);
}
if
(
e
.
y
>
s
.
y
)
{
placeRight
(
s
,
e
);
}
}
private
static
Vector3
startPos
()
{
return
start
;
}
private
static
Vector2
endPos
(
Vector2
start
,
Vector2
end
)
{
if
(
Mathf
.
Abs
(
end
.
x
-
start
.
x
)
>
Mathf
.
Abs
(
end
.
y
-
start
.
y
))
{
// X distance is larger
return
new
Vector2
(
end
.
x
,
start
.
y
);
}
else
{
// Y distance is larger
return
new
Vector2
(
start
.
x
,
end
.
y
);
}
}
private
static
void
placeRight
(
Vector2
start
,
Vector2
end
)
{
if
(
World
.
posInBounds
(
start
)
&&
World
.
posInBounds
(
end
))
{
GameObject
go
=
MapEditor
.
createTileAt
(
start
,
info
.
cap
);
for
(
int
i
=
(
int
)
start
.
x
+
1
;
i
<
(
int
)
end
.
x
;
i
++)
{
go
=
MapEditor
.
createTileAt
(
new
Vector2
(
i
,
start
.
y
),
info
.
mid
);
}
go
=
MapEditor
.
createTileAt
(
end
,
info
.
cap
);
go
.
transform
.
localScale
=
new
Vector3
(
go
.
transform
.
localScale
.
x
*
-
1
,
go
.
transform
.
localScale
.
y
,
go
.
transform
.
localScale
.
z
);
}
}
private
static
void
placeUp
(
Vector2
start
,
Vector2
end
)
{
if
(
World
.
posInBounds
(
start
)
&&
World
.
posInBounds
(
end
))
{
GameObject
go
=
MapEditor
.
createTileAt
(
start
,
info
.
cap
);
go
.
transform
.
rotation
=
Quaternion
.
Euler
(
0
,
90
,
0
);
for
(
int
i
=
(
int
)
start
.
y
+
1
;
i
<
(
int
)
end
.
y
;
i
++)
{
go
=
MapEditor
.
createTileAt
(
new
Vector2
(
start
.
x
,
i
),
info
.
mid
);
}
go
=
MapEditor
.
createTileAt
(
end
,
info
.
cap
);
go
.
transform
.
localScale
=
new
Vector3
(
go
.
transform
.
localScale
.
x
*
-
1
,
go
.
transform
.
localScale
.
y
,
go
.
transform
.
localScale
.
z
);
}
}
/*
if(end.x >= start.x)
{ // Moving right
}
else
{ // Moving left
}
*/
}
Assets/Scripts/MapEditor/DragPlacement.cs.meta
0 → 100644
View file @
1fafa54d
fileFormatVersion: 2
guid: f0357ea37f582024092a790df0762968
timeCreated: 1491766856
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/MapEditor/MapEditor.cs
View file @
1fafa54d
...
...
@@ -9,6 +9,7 @@ public class MapEditor : MonoBehaviour
private
static
GameObject
tile
;
private
static
int
layer
=
0
;
private
static
Transform
tiles
;
private
static
Vector3
mousePosition
;
public
static
bool
On
{
...
...
@@ -33,6 +34,11 @@ public class MapEditor : MonoBehaviour
get
{
return
tiles
;
}
set
{
tiles
=
value
;
}
}
public
static
Vector3
MousePosition
{
get
{
return
mousePosition
;
}
}
#
endregion
public
static
bool
toggle
()
{
return
(
on
=
!
on
);
}
...
...
@@ -59,17 +65,40 @@ public class MapEditor : MonoBehaviour
{
if
(
MapEditor
.
On
)
{
if
(
Event
.
current
.
button
==
0
&&
(
Event
.
current
.
type
==
EventType
.
MouseDown
||
Event
.
current
.
type
==
EventType
.
MouseDrag
)
)
if
(
Event
.
current
.
button
==
0
)
{
Vector3
mouse
=
Event
.
current
.
mousePosition
;
mouse
.
y
=
-
mouse
.
y
;
Vector2
pos
=
Camera
.
current
.
ScreenToWorldPoint
(
mouse
);
createTileAt
(
mousePosCorrection
(
pos
));
Event
.
current
.
Use
();
if
((
Event
.
current
.
type
==
EventType
.
MouseDown
||
Event
.
current
.
type
==
EventType
.
MouseDrag
)
&&
(
Event
.
current
.
button
==
0
))
{
Vector3
mouse
=
Event
.
current
.
mousePosition
;
mouse
.
y
=
-
mouse
.
y
;
Vector2
pos
=
Camera
.
current
.
ScreenToWorldPoint
(
mouse
);
mousePosition
=
vector3From2
(
mousePosCorrection
(
pos
),
layer
);
createTileAt
(
mousePosCorrection
(
pos
));
Event
.
current
.
Use
();
//Debug.Log("MouseDown " + mousePosCorrection(pos));
}
if
((
Event
.
current
.
type
==
EventType
.
MouseUp
)
&&
(
Event
.
current
.
button
==
0
))
{
if
(
DragPlacement
.
running
())
{
DragPlacement
.
endDrag
();
}
Event
.
current
.
Use
();
//Debug.Log("MouseUp");
}
}
}
}
private
static
Vector3
vector3From2
(
Vector2
v
,
float
z
)
{
return
new
Vector3
(
v
.
x
,
v
.
y
,
z
);
}
static
Vector2
mousePosCorrection
(
Vector2
pos
)
{
pos
.
x
=
Mathf
.
Floor
(
pos
.
x
+
.
5f
);
...
...
@@ -77,26 +106,37 @@ public class MapEditor : MonoBehaviour
return
pos
;
}
public
static
void
createTileAt
(
Vector2
pos
)
public
static
GameObject
createTileAt
(
Vector2
pos
,
GameObject
t
=
null
)
{
if
(
t
==
null
)
{
t
=
Tile
;
}
if
(!
World
.
Ready
())
{
Debug
.
LogError
(
"World not initialized! Please set a width, height, and depth in the inspector and click \"Set\"."
);
return
;
return
null
;
}
if
(
World
.
posInBounds
(
pos
,
Layer
)
&&
(
Tile
==
null
||
!
World
.
posIsThis
(
pos
,
Layer
,
Tile
)))
if
(
World
.
posInBounds
(
pos
,
Layer
)
&&
(
t
==
null
||
!
World
.
posIsThis
(
pos
,
Layer
,
t
)))
{
if
(
Tiles
==
null
)
GameObject
.
FindObjectOfType
<
MapEditor
>().
setupTilesParent
();
if
(
Tile
!=
null
)
if
(
t
!=
null
)
{
if
(
!
World
.
posIsThis
(
pos
,
Tile
)
)
if
(
t
.
GetComponent
<
DragPlaceInfo
>()
!=
null
)
{
Debug
.
Log
(
"new"
);
GameObject
go
=
(
GameObject
)
GameObject
.
Instantiate
(
Tile
,
new
Vector3
(
pos
.
x
,
pos
.
y
,
Layer
),
Quaternion
.
identity
);
go
=
PrefabUtility
.
ConnectGameObjectToPrefab
(
go
,
Tile
);
if
(!
DragPlacement
.
running
())
{
DragPlacement
.
startDrag
(
pos
,
t
.
GetComponent
<
DragPlaceInfo
>());
}
}
else
if
(!
World
.
posIsThis
(
pos
,
t
))
{
GameObject
go
=
(
GameObject
)
GameObject
.
Instantiate
(
t
,
new
Vector3
(
pos
.
x
,
pos
.
y
,
Layer
),
Quaternion
.
identity
);
go
=
PrefabUtility
.
ConnectGameObjectToPrefab
(
go
,
t
);
go
.
transform
.
position
=
new
Vector3
(
pos
.
x
,
pos
.
y
,
Layer
);
...
...
@@ -107,15 +147,20 @@ public class MapEditor : MonoBehaviour
}
go
.
transform
.
parent
=
Tiles
;
World
.
set
(
pos
,
layer
,
go
);
return
go
;
}
else
Debug
.
Log
(
"new"
);
}
else
{
World
.
set
(
pos
,
layer
,
null
);
}
}
else
{
//Debug.Log("Out Of Bounds! " + string.Format("{0}, {1}, {2}", World.Width, World.Height, pos));
}
return
null
;
}
}
...
...
@@ -147,8 +192,8 @@ public class MapEditorEditor : Editor
// Toggle on field
MapEditor
.
On
=
GUILayout
.
Toggle
(
MapEditor
.
On
,
"ON"
);
// Initialize Borders
/*
// Initialize Borders
if(GUILayout.Button("Initialize Borders"))
Borders
.
initializeAll
();
Borders.initializeAll();
*/
}
}
Assets/Scripts/MapEditor/World.cs
View file @
1fafa54d
...
...
@@ -118,7 +118,7 @@ public static class World
{
if
(
x
<
0
||
y
<
0
||
z
<
0
||
x
>=
width
||
y
>=
height
||
z
>=
depth
)
{
//Debug.LogWarning("Pos out of bounds!");
//Debug.LogWarning("Pos out of bounds!"
+ Width + " " + Height
);
return
false
;
}
return
true
;
...
...
@@ -144,7 +144,7 @@ public static class World
GameObject
tileParent
=
GameObject
.
FindGameObjectWithTag
(
"Tiles Parent"
);
if
(
tileParent
!=
null
)
{
getGOBounds
();
//
getGOBounds();
for
(
int
i
=
0
;
i
<
tileParent
.
transform
.
childCount
;
i
++)
{
GameObject
go
=
tileParent
.
transform
.
GetChild
(
i
).
gameObject
;
...
...
Assets/Scripts/Player/CameraFollow.cs
View file @
1fafa54d
...
...
@@ -35,7 +35,7 @@ public class CameraFollow : SingletonBehaviour<CameraFollow>
OZ
=
cameraObj
.
transform
.
position
.
z
;
Debug
.
Log
(
World
.
Width
+
" | "
+
World
.
Height
);
//
Debug.Log(World.Width + " | " + World.Height);
}
// Update is called once per frame
...
...
@@ -50,10 +50,10 @@ public class CameraFollow : SingletonBehaviour<CameraFollow>
float
camWidth
=
cameraObj
.
aspect
*
camHeight
;
Debug
.
Log
(
"maxHeight: "
+
MaxHeight
+
/*
Debug.Log("maxHeight: " + MaxHeight +
"\nmaxWidth: " + MaxWidth);
Debug.Log("minHeight: " + MinHeight +
"\nminWidth: "
+
MinWidth
);
"\nminWidth: " + MinWidth);
*/
// If too wide...
if
(
MinWidth
>=
MaxWidth
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment