Browse Source

Map generation added

Food started
master
MB 5 years ago
parent
commit
09f9c550c9
5 changed files with 514 additions and 72 deletions
  1. +2
    -2
      Assets/Scenes/ClientScene.unity
  2. +349
    -37
      Assets/Scenes/MainScene.unity
  3. +144
    -33
      Assets/Scipts/Map.cs
  4. +8
    -0
      Assets/Scipts/Tile.cs
  5. +11
    -0
      Assets/Scipts/Tile.cs.meta

+ 2
- 2
Assets/Scenes/ClientScene.unity View File

@ -140,10 +140,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4286216c0dea5f64e8d5a8b674f60424, type: 3} m_Script: {fileID: 11500000, guid: 4286216c0dea5f64e8d5a8b674f60424, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
ServerAddress: 127.0.0.1
ServerAddress: 10.17.38.221
Port: 4444 Port: 4444
ConnectOnStart: 0 ConnectOnStart: 0
Name: The Black Burrito
Name: The Nardliest one
--- !u!4 &914867462 --- !u!4 &914867462
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

+ 349
- 37
Assets/Scenes/MainScene.unity View File

@ -113,6 +113,118 @@ NavMeshSettings:
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1 &35195568
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 35195569}
- component: {fileID: 35195572}
- component: {fileID: 35195571}
- component: {fileID: 35195570}
m_Layer: 5
m_Name: Recipe
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &35195569
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 35195568}
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:
- {fileID: 327933318}
m_Father: {fileID: 1266934409}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 272, y: 192}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &35195570
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 35195568}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 35195571}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &35195571
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 35195568}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &35195572
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 35195568}
m_CullTransparentMesh: 0
--- !u!1 &80434429 --- !u!1 &80434429
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -125,7 +237,7 @@ GameObject:
- component: {fileID: 80434431} - component: {fileID: 80434431}
- component: {fileID: 80434430} - component: {fileID: 80434430}
m_Layer: 0 m_Layer: 0
m_Name: Cube
m_Name: Model
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -191,12 +303,44 @@ Transform:
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 80434429} m_GameObject: {fileID: 80434429}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 5}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 1492969500}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &191822287
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 191822288}
m_Layer: 0
m_Name: Unneeded
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &191822288
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 191822287}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 353.89233, y: 77.27744, z: -2.9375}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 2005481975}
- {fileID: 700181637}
- {fileID: 1779215479}
- {fileID: 1195683501}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 8
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &236454819 --- !u!1 &236454819
GameObject: GameObject:
@ -353,6 +497,81 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 166} m_AnchoredPosition: {x: 0, y: 166}
m_SizeDelta: {x: 100, y: 100} m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &327933317
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 327933318}
- component: {fileID: 327933320}
- component: {fileID: 327933319}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &327933318
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 327933317}
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: 35195569}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &327933319
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 327933317}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Recipe
--- !u!222 &327933320
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 327933317}
m_CullTransparentMesh: 0
--- !u!1 &340012148 --- !u!1 &340012148
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -362,6 +581,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 340012150} - component: {fileID: 340012150}
- component: {fileID: 340012149} - component: {fileID: 340012149}
- component: {fileID: 340012151}
m_Layer: 0 m_Layer: 0
m_Name: GameManager m_Name: GameManager
m_TagString: Untagged m_TagString: Untagged
@ -392,12 +612,32 @@ Transform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 340012148} m_GameObject: {fileID: 340012148}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 705.9767, y: 252.42975, z: -5.8589115}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &340012151
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 340012148}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fb1b808875f0dab4f9905cced86ca98a, type: 3}
m_Name:
m_EditorClassIdentifier:
LocalPlayer: {fileID: 1492969498}
Tiles: []
Landmarks: []
MapGrid: []
WorldWrapGrid: []
minX: -50
maxX: 50
minZ: -50
maxZ: 50
--- !u!1 &426060142 --- !u!1 &426060142
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -629,9 +869,9 @@ Camera:
near clip plane: 0.3 near clip plane: 0.3
far clip plane: 1000 far clip plane: 1000
field of view: 60 field of view: 60
orthographic: 1
orthographic: 0
orthographic size: 5 orthographic size: 5
m_Depth: 0
m_Depth: -1
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
@ -653,7 +893,7 @@ Transform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 666069794} m_GameObject: {fileID: 666069794}
m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068} m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 452, z: 0}
m_LocalPosition: {x: 0, y: 18, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 1492969500} m_Father: {fileID: 1492969500}
@ -675,7 +915,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!81 &700181635 --- !u!81 &700181635
AudioListener: AudioListener:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -699,8 +939,8 @@ Camera:
m_FocalLength: 50 m_FocalLength: 50
m_NormalizedViewPortRect: m_NormalizedViewPortRect:
serializedVersion: 2 serializedVersion: 2
x: 0
y: 0
x: 1
y: 1
width: 1 width: 1
height: 1 height: 1
near clip plane: 0.3 near clip plane: 0.3
@ -708,7 +948,7 @@ Camera:
field of view: 60 field of view: 60
orthographic: 1 orthographic: 1
orthographic size: 5 orthographic size: 5
m_Depth: -1
m_Depth: 0
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
@ -730,12 +970,81 @@ Transform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 700181634} m_GameObject: {fileID: 700181634}
m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068} m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068}
m_LocalPosition: {x: 707.78467, y: 154.55489, z: -5.875}
m_LocalPosition: {x: 353.89233, y: 77.27744, z: -2.9375}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_Father: {fileID: 191822288}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!1 &1039419383
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1039419384}
- component: {fileID: 1039419386}
- component: {fileID: 1039419385}
m_Layer: 5
m_Name: Inventory
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1039419384
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1039419383}
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: 1266934409}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 274, y: -141}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1039419385
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1039419383}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1039419386
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1039419383}
m_CullTransparentMesh: 0
--- !u!1 &1057999593 --- !u!1 &1057999593
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -947,7 +1256,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!81 &1195683499 --- !u!81 &1195683499
AudioListener: AudioListener:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -971,8 +1280,8 @@ Camera:
m_FocalLength: 50 m_FocalLength: 50
m_NormalizedViewPortRect: m_NormalizedViewPortRect:
serializedVersion: 2 serializedVersion: 2
x: 0
y: 0
x: 1
y: 1
width: 1 width: 1
height: 1 height: 1
near clip plane: 0.3 near clip plane: 0.3
@ -980,7 +1289,7 @@ Camera:
field of view: 60 field of view: 60
orthographic: 1 orthographic: 1
orthographic size: 5 orthographic size: 5
m_Depth: -1
m_Depth: 0
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
@ -1002,11 +1311,11 @@ Transform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1195683498} m_GameObject: {fileID: 1195683498}
m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068} m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068}
m_LocalPosition: {x: 707.78467, y: 154.55489, z: -5.875}
m_LocalPosition: {x: 353.89233, y: 77.27744, z: -2.9375}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_Father: {fileID: 191822288}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!1 &1266934408 --- !u!1 &1266934408
GameObject: GameObject:
@ -1039,6 +1348,8 @@ RectTransform:
- {fileID: 1057999594} - {fileID: 1057999594}
- {fileID: 2018855991} - {fileID: 2018855991}
- {fileID: 264010775} - {fileID: 264010775}
- {fileID: 1039419384}
- {fileID: 35195569}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -1139,10 +1450,11 @@ Transform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1492969498} m_GameObject: {fileID: 1492969498}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: -0, y: 1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 666069797} - {fileID: 666069797}
- {fileID: 80434433}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -1162,7 +1474,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!81 &1779215477 --- !u!81 &1779215477
AudioListener: AudioListener:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1186,8 +1498,8 @@ Camera:
m_FocalLength: 50 m_FocalLength: 50
m_NormalizedViewPortRect: m_NormalizedViewPortRect:
serializedVersion: 2 serializedVersion: 2
x: 0
y: 0
x: 1
y: 1
width: 1 width: 1
height: 1 height: 1
near clip plane: 0.3 near clip plane: 0.3
@ -1195,7 +1507,7 @@ Camera:
field of view: 60 field of view: 60
orthographic: 1 orthographic: 1
orthographic size: 5 orthographic size: 5
m_Depth: -1
m_Depth: 0
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
@ -1217,11 +1529,11 @@ Transform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1779215476} m_GameObject: {fileID: 1779215476}
m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068} m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068}
m_LocalPosition: {x: 707.78467, y: 154.55489, z: -5.875}
m_LocalPosition: {x: 353.89233, y: 77.27744, z: -2.9375}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_Father: {fileID: 191822288}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!1 &1908726377 --- !u!1 &1908726377
GameObject: GameObject:
@ -1361,7 +1673,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!81 &2005481973 --- !u!81 &2005481973
AudioListener: AudioListener:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1385,8 +1697,8 @@ Camera:
m_FocalLength: 50 m_FocalLength: 50
m_NormalizedViewPortRect: m_NormalizedViewPortRect:
serializedVersion: 2 serializedVersion: 2
x: 0
y: 0
x: 1
y: 1
width: 1 width: 1
height: 1 height: 1
near clip plane: 0.3 near clip plane: 0.3
@ -1394,7 +1706,7 @@ Camera:
field of view: 60 field of view: 60
orthographic: 1 orthographic: 1
orthographic size: 5 orthographic size: 5
m_Depth: -1
m_Depth: 0
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
@ -1416,11 +1728,11 @@ Transform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2005481972} m_GameObject: {fileID: 2005481972}
m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068} m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068}
m_LocalPosition: {x: 707.78467, y: 154.55489, z: -5.875}
m_LocalPosition: {x: -353.89233, y: -77.27744, z: 2.9375}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_Father: {fileID: 191822288}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!1 &2018855990 --- !u!1 &2018855990
GameObject: GameObject:

+ 144
- 33
Assets/Scipts/Map.cs View File

@ -4,8 +4,14 @@ using UnityEngine;
public class Map : MonoBehaviour { public class Map : MonoBehaviour {
public GameMode mode; //Reference to the scenes gamemode script
GameObject LocalPlayer;
public GameObject LocalPlayer;
public GameObject[] Tiles;
public List<GameObject> Landmarks;
public GameObject[] MapGrid;
public GameObject[] WorldWrapGrid;
//Minimum and maximum values for the map //Minimum and maximum values for the map
public float minX; public float minX;
@ -13,28 +19,84 @@ public class Map : MonoBehaviour {
public float minZ; public float minZ;
public float maxZ; public float maxZ;
public GameObject TopCam;
public GameObject BotCam;
public GameObject LeftCam;
public GameObject RightCam;
/*
public Camera TopCam;
public Camera BotCam;
public Camera LeftCam;
public Camera RightCam;
*/
#region StartupFunctions
private void Start()
{
//GenerateMap();
CreateDummys();
}
//How wide halfd the camera is for the resizing
public float camWidth = 8.0f;
public float camHeight = 5.0f;
//Create dummy players for the world wrapping
void CreateDummys()
{
List<GameObject> Players = new List<GameObject>();
foreach (GameObject Player in Players)
{
Transform PT = Player.transform;
Transform model = PT.FindChild("Model");
Instantiate(model, new Vector3(PT.position.x + minX, PT.position.y, PT.position.z), transform.rotation, PT);
Instantiate(model, new Vector3(PT.position.x + maxX, PT.position.y, PT.position.z), transform.rotation, PT);
Instantiate(model, new Vector3(PT.position.x, PT.position.y, PT.position.z + minZ), transform.rotation, PT);
Instantiate(model, new Vector3(PT.position.x, PT.position.y, PT.position.z + maxZ), transform.rotation, PT);
}
}
void GenerateMap()
{
GameObject[] gameTiles = new GameObject[4];
for (int i = 0; i < 4; i++)
{
int rand = Random.Range(0, Tiles.Length);
GameObject tile = Instantiate(Tiles[rand], MapGrid[i].transform.position, Quaternion.identity);
PopulateTile(tile.GetComponent<Tile>());
gameTiles[i] = tile;
}
//Create the fake tiles for the world wrapping (This is done super poorly and quickly, don't judge me :)
Instantiate(gameTiles[0], WorldWrapGrid[6].transform);
Instantiate(gameTiles[0], WorldWrapGrid[10].transform);
Instantiate(gameTiles[0], WorldWrapGrid[12].transform);
Instantiate(gameTiles[1], WorldWrapGrid[5].transform);
Instantiate(gameTiles[1], WorldWrapGrid[9].transform);
Instantiate(gameTiles[1], WorldWrapGrid[11].transform);
Instantiate(gameTiles[2], WorldWrapGrid[2].transform);
Instantiate(gameTiles[2], WorldWrapGrid[4].transform);
Instantiate(gameTiles[2], WorldWrapGrid[8].transform);
Instantiate(gameTiles[3], WorldWrapGrid[1].transform);
Instantiate(gameTiles[3], WorldWrapGrid[3].transform);
Instantiate(gameTiles[3], WorldWrapGrid[7].transform);
}
//Populate the tile with landmarks
void PopulateTile(Tile tile)
{
foreach(GameObject LP in tile.LandmarkPoints)
{
if (Landmarks.Count > 0)
{
int rand = Random.Range(0, Landmarks.Count);
Instantiate(Landmarks[rand], LP.transform.position, Quaternion.identity, tile.transform.parent);
}
}
}
#endregion
void Update() void Update()
{ {
Teleport(); Teleport();
HandleCameraMovement(TopCam, true);
HandleCameraMovement(BotCam, true);
HandleCameraMovement(LeftCam, false);
HandleCameraMovement(RightCam, false);
} }
void Teleport() void Teleport()
{ {
Transform PT = LocalPlayer.transform;
Transform PT = LocalPlayer.transform;
if (PT.position.x > maxX) if (PT.position.x > maxX)
{ {
PT.position = new Vector3(minX, PT.position.y, PT.position.z); PT.position = new Vector3(minX, PT.position.y, PT.position.z);
@ -47,31 +109,80 @@ public class Map : MonoBehaviour {
{ {
PT.position = new Vector3(PT.position.x, PT.position.y, minZ); PT.position = new Vector3(PT.position.x, PT.position.y, minZ);
} }
else if (PT.position.x < minX)
else if (PT.position.z < minZ)
{ {
PT.position = new Vector3(PT.position.x, PT.position.y, maxZ); PT.position = new Vector3(PT.position.x, PT.position.y, maxZ);
} }
} }
/// <summary>
///
/// </summary>
/// <param name="Cam"> The camera to move</param>
/// <param name="Xmove">Do we move in the X axis or the Z?</param>
void HandleCameraMovement(GameObject Cam, bool Xmove)
{
if (Xmove == true)
}
//EXTRA STUFF, PLEASE IGNORE
/*
* //IN UPDATE
HandleCameraMovement(TopCam, true);
HandleCameraMovement(BotCam, true);
HandleCameraMovement(LeftCam, false);
HandleCameraMovement(RightCam, false);
HandleCamSizing();
*/
/*
/// <summary>
///
/// </summary>
/// <param name="Cam"> The camera to move</param>
/// <param name="Xmove">Do we move in the X axis or the Z?</param>
void HandleCameraMovement(Camera Cam, bool Xmove)
{ {
Cam.transform.position = new Vector3(LocalPlayer.transform.position.x, Cam.transform.position.y, Cam.transform.position.z);
if (Xmove == true)
{
Cam.transform.position = new Vector3(LocalPlayer.transform.position.x, Cam.transform.position.y, Cam.transform.position.z);
}
else
{
Cam.transform.position = new Vector3(Cam.transform.position.x, Cam.transform.position.y, LocalPlayer.transform.position.z);
}
} }
else
void HandleCamSizing()
{ {
Cam.transform.position = new Vector3(Cam.transform.position.x, Cam.transform.position.y, LocalPlayer.transform.position.z);
Transform PT = LocalPlayer.transform;
if (PT.position.x > maxX - camWidth)
{
float dif = ((maxX - PT.position.x) / camWidth) / 2;
SetCam(dif, 0, RightCam);
}
else if (PT.position.x < minX + camWidth)
{
float dif = ((minX - PT.position.x) / camWidth) / 2;
SetCam(dif, 0, LeftCam);
}
else
{
SetCam(1, 1, RightCam);
SetCam(1, 1, LeftCam);
}
if (PT.position.z > maxZ - camHeight)
{
float dif = ((maxZ - PT.position.z) / camHeight) / 2;
SetCam(0, dif, TopCam);
}
else if (PT.position.x < + camHeight)
{
float dif = ((minZ - PT.position.z) / camHeight) / 2;
SetCam(0, dif, BotCam);
}
else
{
SetCam(1, 1, RightCam);
SetCam(1, 1, LeftCam);
}
} }
}
void HandleCamSizing()
{
}
}
void SetCam(float x, float y, Camera cam)
{
cam.rect = new Rect(x, y, 1, 1);
}
*/

+ 8
- 0
Assets/Scipts/Tile.cs View File

@ -0,0 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Tile : MonoBehaviour {
public GameObject[] LandmarkPoints;
}

+ 11
- 0
Assets/Scipts/Tile.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2301390022f0d72478aae034e36cd8ff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Loading…
Cancel
Save