diff --git a/Assets/Scripts/Gameplay.meta b/Assets/Scripts/Gameplay.meta new file mode 100644 index 0000000..e7796cd --- /dev/null +++ b/Assets/Scripts/Gameplay.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4e4e17e5beebfb746ac8d3e8d10c137b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/GameStateController.cs b/Assets/Scripts/Gameplay/GameStateController.cs new file mode 100644 index 0000000..6f95814 --- /dev/null +++ b/Assets/Scripts/Gameplay/GameStateController.cs @@ -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() + { + + } +} diff --git a/Assets/Scripts/Gameplay/GameStateController.cs.meta b/Assets/Scripts/Gameplay/GameStateController.cs.meta new file mode 100644 index 0000000..c31d2ba --- /dev/null +++ b/Assets/Scripts/Gameplay/GameStateController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 24cee4f9f3aafc34fb344ec4b026a3ae +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/KillZone.cs b/Assets/Scripts/Gameplay/KillZone.cs new file mode 100644 index 0000000..0e9d2f4 --- /dev/null +++ b/Assets/Scripts/Gameplay/KillZone.cs @@ -0,0 +1,28 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class KillZone : MonoBehaviour +{ + public HerdController herd; + + // Start is called before the first frame update + void Start() + { + herd = FindObjectOfType(); + } + + private void OnTriggerEnter(Collider other) + { + Debug.Log("Hit"); + PlayerController horse = other.GetComponent(); + if (horse != null) + herd.RemoveHorse(horse); + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/Scripts/Gameplay/KillZone.cs.meta b/Assets/Scripts/Gameplay/KillZone.cs.meta new file mode 100644 index 0000000..7a11166 --- /dev/null +++ b/Assets/Scripts/Gameplay/KillZone.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a6921e276aa68434aa72e38b4ad0190f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Gameplay/Objective.cs b/Assets/Scripts/Gameplay/Objective.cs new file mode 100644 index 0000000..b6bca65 --- /dev/null +++ b/Assets/Scripts/Gameplay/Objective.cs @@ -0,0 +1,36 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Objective : MonoBehaviour +{ + private List onObjective = new List(); + + private GameStateController GameState; + // Start is called before the first frame update + void Start() + { + GameState = FindObjectOfType(); + } + + private void OnTriggerEnter(Collider other) + { + PlayerController horse = other.GetComponent(); + if (horse != null) + onObjective.Add(horse); + } + + private void OnTriggerExit(Collider other) + { + PlayerController horse = other.GetComponent(); + if (horse != null) + onObjective.Remove(horse); + } + + // Update is called once per frame + void Update() + { + if(onObjective.Count >= 10) + GameState.WinState(); + } +} diff --git a/Assets/Scripts/Gameplay/Objective.cs.meta b/Assets/Scripts/Gameplay/Objective.cs.meta new file mode 100644 index 0000000..3eb3ff7 --- /dev/null +++ b/Assets/Scripts/Gameplay/Objective.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7ae3efa00f9dbc5458f2601705870f17 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Input/HerdController.cs b/Assets/Scripts/Input/HerdController.cs index e07d015..9c1e263 100644 --- a/Assets/Scripts/Input/HerdController.cs +++ b/Assets/Scripts/Input/HerdController.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; +using System.Linq.Expressions; using UnityEngine; using UnityEngine.InputSystem; @@ -26,8 +27,11 @@ public class HerdController : MonoBehaviour private List Herd; private Vector2 recievedInput; + public GameStateController GameState; + void Start() { + GameState = FindObjectOfType(); SpawnHerd(); } @@ -125,6 +129,10 @@ public class HerdController : MonoBehaviour Centre.position = centreofMass/CountedHorses; Centre.localScale = bound.size * 0.9f; } + else + { + GameState.LoseState(); + } } public void RemoveHorse(PlayerController horse)