Browse Source

Added basic game states and objective

master
NickFowler 4 years ago
parent
commit
230a654a9f
7 changed files with 290 additions and 10 deletions
  1. +207
    -10
      Assets/Scenes/SampleScene.unity
  2. +8
    -0
      Assets/Scripts/Gameplay.meta
  3. +28
    -0
      Assets/Scripts/Gameplay/GameStateController.cs
  4. +11
    -0
      Assets/Scripts/Gameplay/GameStateController.cs.meta
  5. +18
    -0
      Assets/Scripts/Gameplay/Objective.cs
  6. +11
    -0
      Assets/Scripts/Gameplay/Objective.cs.meta
  7. +7
    -0
      Assets/Scripts/Input/HerdController.cs

+ 207
- 10
Assets/Scenes/SampleScene.unity View File

@ -208,12 +208,42 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 33826417} m_GameObject: {fileID: 33826417}
m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068} m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: -21.69, y: -1.012, z: 20.28}
m_LocalPosition: {x: -21.69, y: 5.288, z: 20.28}
m_LocalScale: {x: 15.892654, y: 14.241516, z: 1} m_LocalScale: {x: 15.892654, y: 14.241516, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 5 m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0} m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0}
--- !u!1 &338695192
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 338695193}
m_Layer: 0
m_Name: CameraTarget
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &338695193
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 338695192}
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: 1457452761}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &380641380 --- !u!1 &380641380
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -301,8 +331,8 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 380641380} m_GameObject: {fileID: 380641380}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.8334109, y: -6.424332, z: 13.56534}
m_LocalScale: {x: 46.966, y: 1, z: 56.905}
m_LocalPosition: {x: 0.8334109, y: 0, z: 13.56534}
m_LocalScale: {x: 403.69156, y: 1, z: 291.63242}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 3 m_RootOrder: 3
@ -394,7 +424,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 383575962} m_GameObject: {fileID: 383575962}
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: -5.23, z: 7.37}
m_LocalPosition: {x: 0, y: 1.0700002, z: 7.37}
m_LocalScale: {x: 5, y: 5, z: 5} m_LocalScale: {x: 5, y: 5, z: 5}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -579,7 +609,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 778362041} m_GameObject: {fileID: 778362041}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.8334109, y: -1.012, z: 27.1}
m_LocalPosition: {x: 0.8334109, y: 5.288, z: 27.1}
m_LocalScale: {x: 44.013, y: 14.241516, z: 1} m_LocalScale: {x: 44.013, y: 14.241516, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -672,7 +702,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 903473255} m_GameObject: {fileID: 903473255}
m_LocalRotation: {x: -0.23348022, y: -0, z: -0, w: 0.97236156} m_LocalRotation: {x: -0.23348022, y: -0, z: -0, w: 0.97236156}
m_LocalPosition: {x: 9.03, y: -5.55, z: 0}
m_LocalPosition: {x: 9.03, y: 0.75, z: 0}
m_LocalScale: {x: 7.4761, y: 1, z: 4.4214} m_LocalScale: {x: 7.4761, y: 1, z: 4.4214}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -689,6 +719,7 @@ GameObject:
- component: {fileID: 963194228} - component: {fileID: 963194228}
- component: {fileID: 963194227} - component: {fileID: 963194227}
- component: {fileID: 963194226} - component: {fileID: 963194226}
- component: {fileID: 963194229}
m_Layer: 0 m_Layer: 0
m_Name: Main Camera m_Name: Main Camera
m_TagString: MainCamera m_TagString: MainCamera
@ -728,7 +759,7 @@ Camera:
width: 1 width: 1
height: 1 height: 1
near clip plane: 0.3 near clip plane: 0.3
far clip plane: 1000
far clip plane: 200
field of view: 60 field of view: 60
orthographic: 0 orthographic: 0
orthographic size: 5 orthographic size: 5
@ -761,6 +792,63 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!114 &963194229
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 49812763c430a0f4cb0f5e99a203f1ad, type: 3}
m_Name:
m_EditorClassIdentifier:
target: {fileID: 338695192}
camHeight: 25
--- !u!1 &1065404629
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1065404631}
- component: {fileID: 1065404630}
m_Layer: 0
m_Name: Game State Controller
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1065404630
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1065404629}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 24cee4f9f3aafc34fb344ec4b026a3ae, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1065404631
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1065404629}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 28.266376, y: -59.30715, z: 117.915985}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1457452758 --- !u!1 &1457452758
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -823,10 +911,11 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Prefab: {fileID: 7371939184051845554, guid: f5c2c9744b6f46e4e95ca41ab1d8d560, type: 3} Prefab: {fileID: 7371939184051845554, guid: f5c2c9744b6f46e4e95ca41ab1d8d560, type: 3}
HerdCount: 100
HerdCount: 20
SpawnPoint: {fileID: 0} SpawnPoint: {fileID: 0}
WaitTime: 0.2 WaitTime: 0.2
Centre: {fileID: 0}
Centre: {fileID: 338695193}
GameState: {fileID: 0}
--- !u!4 &1457452761 --- !u!4 &1457452761
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -837,7 +926,115 @@ Transform:
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: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Children:
- {fileID: 338695193}
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}
--- !u!1 &1983113841
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1983113846}
- component: {fileID: 1983113845}
- component: {fileID: 1983113844}
- component: {fileID: 1983113843}
- component: {fileID: 1983113842}
m_Layer: 0
m_Name: Objective
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1983113842
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1983113841}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7ae3efa00f9dbc5458f2601705870f17, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!136 &1983113843
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1983113841}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
m_Radius: 0.5000001
m_Height: 2
m_Direction: 1
m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697}
--- !u!23 &1983113844
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1983113841}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, 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_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &1983113845
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1983113841}
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1983113846
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1983113841}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -71.9, y: 1.22, z: 0}
m_LocalScale: {x: 10, y: 1, z: 10}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

+ 8
- 0
Assets/Scripts/Gameplay.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4e4e17e5beebfb746ac8d3e8d10c137b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 28
- 0
Assets/Scripts/Gameplay/GameStateController.cs View File

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameStateController : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
public void WinState()
{
Debug.Log("You win!");
}
public void LoseState()
{
Debug.Log("You lose!");
}
// Update is called once per frame
void Update()
{
}
}

+ 11
- 0
Assets/Scripts/Gameplay/GameStateController.cs.meta View File

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

+ 18
- 0
Assets/Scripts/Gameplay/Objective.cs View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Objective : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

+ 11
- 0
Assets/Scripts/Gameplay/Objective.cs.meta View File

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

+ 7
- 0
Assets/Scripts/Input/HerdController.cs View File

@ -1,6 +1,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions;
using UnityEngine; using UnityEngine;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
@ -26,6 +27,8 @@ public class HerdController : MonoBehaviour
private List<PlayerController> Herd; private List<PlayerController> Herd;
private Vector2 recievedInput; private Vector2 recievedInput;
public GameStateController GameState;
void Start() void Start()
{ {
SpawnHerd(); SpawnHerd();
@ -108,6 +111,10 @@ public class HerdController : MonoBehaviour
if (Centre != null) if (Centre != null)
Centre.position = Herd.Aggregate(new Vector3(0, 0, 0), (s, v) => s + v.transform.position) / (float)Herd.Count; Centre.position = Herd.Aggregate(new Vector3(0, 0, 0), (s, v) => s + v.transform.position) / (float)Herd.Count;
if (Herd.Count.Equals(0))
GameState.LoseState();
} }
public void RemoveHorse(PlayerController horse) public void RemoveHorse(PlayerController horse)

Loading…
Cancel
Save