SHADE_Y3/Assets/Scripts/SC_GameManager.cs

63 lines
1.1 KiB
C#
Raw Normal View History

using SHADE;
using System;
using System.Collections.Generic;
public class GameManager : Script
{
public enum GameState
{
MAINMENU,
WIN,
LOSE,
TOTAL
}
public GameObject itemPool;
public GameObject zonePool;
public GameState currGameState;
[NonSerialized]
public int totalItemCount;
[NonSerialized]
public int Score;
[NonSerialized]
public float timer;
private IEnumerable<Item> listOfItems;
private IEnumerable<ScoringZone> listOfZone;
protected override void awake()
{
totalItemCount = 0;
Score = 0;
currGameState = GameState.MAINMENU;
if (itemPool)
{
listOfItems = itemPool.GetScriptsInChildren<Item>();
foreach (Item i in listOfItems)
totalItemCount += 1;
}
if (zonePool)
{
listOfZone = itemPool.GetScriptsInChildren<ScoringZone>();
foreach (ScoringZone i in listOfZone)
i.gameManger = Owner.GetScript<GameManager>();
}
}
protected override void update()
{
if (timer > 0)
timer -= Time.DeltaTimeF;
else
currGameState = GameState.LOSE;
}
protected override void onTriggerEnter(CollisionInfo info)
{
}
}