34 lines
897 B
C#
34 lines
897 B
C#
using UnityEngine;
|
|
|
|
public class FocalPointController : MonoBehaviour
|
|
{
|
|
private FocalPoint[] points;
|
|
private ObjectiveHandler objectiveHandler;
|
|
|
|
void Awake() {
|
|
points = GetComponentsInChildren<FocalPoint>();
|
|
Debug.LogFormat("Found Focal Points: {0}", points.Length);
|
|
objectiveHandler = GetComponent<ObjectiveHandler>();
|
|
if (objectiveHandler != null) {
|
|
Debug.LogFormat("Found objective: {0}", objectiveHandler.Description);
|
|
}
|
|
}
|
|
|
|
void Update() {
|
|
if (CheckFullCollision()) {
|
|
if (objectiveHandler != null) {
|
|
objectiveHandler.OnObjectiveComplete(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
private bool CheckFullCollision() {
|
|
foreach (FocalPoint point in points) {
|
|
if (!point.GetIsInGoal()) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
}
|