SHADE_Y3/Assets/Scripts/SC_GameManager.cs

44 lines
782 B
C#
Raw Normal View History

using SHADE;
using System;
using System.Collections.Generic;
public class GameManager : Script
{
enum GameState
{
}
public GameObject itemPool;
public int totalItemCount;
public int Score;
private IEnumerable<Item> listOfItems;
protected override void awake()
{
totalItemCount = 0;
Score = 0;
if (itemPool)
{
listOfItems = itemPool.GetScriptsInChildren<Item>();
foreach (Item i in listOfItems)
totalItemCount += 1;
}
}
protected override void update()
{
}
protected override void onTriggerEnter(CollisionInfo info)
{
if (info.GameObject.GetScript<Item>())
{
totalItemCount -= 1;
Score = info.GameObject.GetScript<Item>().Score;
info.GameObject.SetActive(false);
}
}
}