Browse Source

Merge branch 'master' of https://bitbucket.org/JoshuaReason/ggj2020

# Conflicts:
#	Assets/Scenes/SampleScene.unity
master
Joshua Reason 4 years ago
parent
commit
ca8409dc79
8 changed files with 141 additions and 0 deletions
  1. +8
    -0
      Assets/Scripts/Gameplay.meta
  2. +28
    -0
      Assets/Scripts/Gameplay/GameStateController.cs
  3. +11
    -0
      Assets/Scripts/Gameplay/GameStateController.cs.meta
  4. +28
    -0
      Assets/Scripts/Gameplay/KillZone.cs
  5. +11
    -0
      Assets/Scripts/Gameplay/KillZone.cs.meta
  6. +36
    -0
      Assets/Scripts/Gameplay/Objective.cs
  7. +11
    -0
      Assets/Scripts/Gameplay/Objective.cs.meta
  8. +8
    -0
      Assets/Scripts/Input/HerdController.cs

+ 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:

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

@ -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<HerdController>();
}
private void OnTriggerEnter(Collider other)
{
Debug.Log("Hit");
PlayerController horse = other.GetComponent<PlayerController>();
if (horse != null)
herd.RemoveHorse(horse);
}
// Update is called once per frame
void Update()
{
}
}

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

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

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

@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Objective : MonoBehaviour
{
private List<PlayerController> onObjective = new List<PlayerController>();
private GameStateController GameState;
// Start is called before the first frame update
void Start()
{
GameState = FindObjectOfType<GameStateController>();
}
private void OnTriggerEnter(Collider other)
{
PlayerController horse = other.GetComponent<PlayerController>();
if (horse != null)
onObjective.Add(horse);
}
private void OnTriggerExit(Collider other)
{
PlayerController horse = other.GetComponent<PlayerController>();
if (horse != null)
onObjective.Remove(horse);
}
// Update is called once per frame
void Update()
{
if(onObjective.Count >= 10)
GameState.WinState();
}
}

+ 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:

+ 8
- 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,8 +27,11 @@ 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()
{ {
GameState = FindObjectOfType<GameStateController>();
SpawnHerd(); SpawnHerd();
} }
@ -125,6 +129,10 @@ public class HerdController : MonoBehaviour
Centre.position = centreofMass/CountedHorses; Centre.position = centreofMass/CountedHorses;
Centre.localScale = bound.size * 0.9f; Centre.localScale = bound.size * 0.9f;
} }
else
{
GameState.LoseState();
}
} }
public void RemoveHorse(PlayerController horse) public void RemoveHorse(PlayerController horse)

Loading…
Cancel
Save