Update SurvivalIsland

This commit is contained in:
xixu-me committed 2025-03-20 08:35:10 +08:00
1 parent 83adad7d01
commit c404a1c315
46 files changed
+210 -42

No files matched your search

+33 -1
View File
@@ -3,11 +3,43 @@ using System.Collections;
public class TriggerZone : MonoBehaviour
{
public AudioClip lockedSound;
public Light doorLight;
public GUIText textHints;
void OnTriggerEnter(Collider col)
{
if (col.gameObject.tag == "Player")
{
transform.FindChild("door").SendMessage("DoorCheck");
if (Inventory.charge == 4)
{
transform.FindChild("door").
SendMessage("DoorCheck");
if (GameObject.Find("PowerGUI"))
{
Destroy(GameObject.Find("PowerGUI"));
doorLight.color = Color.green;
}
}
else if (Inventory.charge > 0 && Inventory.charge < 4)
{
textHints.SendMessage("ShowHint",
"This door won't budge.. " +
"guess it needs fully charging - " +
"maybe more power cells will help...");
transform.FindChild("door").audio.
PlayOneShot(lockedSound);
}
else
{
transform.FindChild("door").audio.
PlayOneShot(lockedSound);
col.gameObject.SendMessage("HUDon");
textHints.SendMessage("ShowHint",
"This door seems locked.. maybe that " +
"generator needs power...");
}
}
}
}