public static RespawnPoint GetInitRespawn() { RespawnPoint respawn = null; int initRespawns = 0; foreach (RespawnPoint point in FindObjectsOfType <RespawnPoint>()) { if (point.initialSpawn) { respawn = point; initRespawns++; } } if (initRespawns == 0) { Debug.LogWarning("No initial respawn point detected."); } else if (initRespawns > 1) { Debug.LogWarning("More than one initial respawn point detected."); } return(respawn); }
private void Awake() { controller = GetComponent <InputController>(); playerCollider = GetComponent <Collider2D>(); lantern = GetComponentInChildren <Lantern>(); if (respawn == null) { respawn = RespawnPoint.GetInitRespawn(); } }
public override void OnInspectorGUI() { RespawnPoint respawn = (RespawnPoint)target; DrawDefaultInspector(); if (GUILayout.Button("Add Lamp")) { respawn.AddLamp(); } if (GUILayout.Button("Remove Lamp")) { respawn.RemoveLamp(); } }