31 lines
725 B
C#
31 lines
725 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ChargeCounter : MonoBehaviour
|
|
{
|
|
GameObject[] chargePoints;
|
|
List<GameObject> chargedPoints = new List<GameObject>();
|
|
|
|
void Start()
|
|
{
|
|
if (chargePoints == null) chargePoints = GameObject.FindGameObjectsWithTag("Charge Point");
|
|
}
|
|
|
|
public void AddChargedPoint(GameObject chargePoint)
|
|
{
|
|
chargedPoints.Add(chargePoint);
|
|
DisplayCharges();
|
|
}
|
|
|
|
public void RemoveChargedPoint(GameObject chargePoint)
|
|
{
|
|
chargedPoints.Remove(chargePoint);
|
|
DisplayCharges();
|
|
}
|
|
|
|
void DisplayCharges()
|
|
{
|
|
Debug.Log("Total Points:" + chargedPoints.Count);
|
|
}
|
|
}
|