objective interface

This commit is contained in:
zmoixdev
2026-03-08 18:50:02 -06:00
parent 2e3541579f
commit de3bec4ef3
148 changed files with 65967 additions and 146 deletions

View File

@@ -0,0 +1,23 @@
using UnityEngine;
[System.Serializable]
public class FocalPoint : MonoBehaviour
{
[SerializeField] bool isInGoal = false;
void OnTriggerEnter(Collider other) {
if (other.gameObject.tag == "Goal") {
isInGoal = true;
}
}
void OnTriggerExit(Collider other) {
if (other.gameObject.tag == "Goal") {
isInGoal = false;
}
}
public bool GetIsInGoal() {
return isInGoal;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9bef8358876e3c847990d3e29aae0e3b

View File

@@ -0,0 +1,69 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1153945551318506251
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8259357874701873392}
- component: {fileID: 376530815406970396}
- component: {fileID: 2880737604923909716}
m_Layer: 0
m_Name: FocalPoint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8259357874701873392
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1153945551318506251}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -0.488, z: 1.681}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &376530815406970396
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1153945551318506251}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9bef8358876e3c847990d3e29aae0e3b, type: 3}
m_Name:
m_EditorClassIdentifier:
isInGoal: 0
--- !u!135 &2880737604923909716
SphereCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1153945551318506251}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 1
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Radius: 0.5
m_Center: {x: 0, y: 0, z: 0}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 19e6af4b6ae5eab47a2ab508f9e6d122
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
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;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 017817a68655333448e30f0ec2de9734