public void TowerCheckpointCaptured(TowerBase tower) { UIManager.Instance.UINotifyHeader("Checkpoint Captured!"); UIManager.Instance.UINotifySecondary("The next checkpoint has been revealed."); Debug.Log("Checkpoint tower captured"); tower.TowerCaptured -= TowerCheckpointCaptured; // Prevent notification from calling again tower.TowerEntered = null; tower.TowerExited = null; SetCurrentTower(null); tower.RevealNext(); // Replace tower with checkpoint TowerHost th = tower.GetComponent <TowerHost>(); TowerClient tc = tower.GetComponent <TowerClient>(); if (th != null) { Destroy(th); } if (tc != null) { Destroy(tc); } int priority = tower.GetPriority(); if (m_CurrentCheckpointPriority <= priority) { tower.GetComponent <Checkpoint>().Activate(); m_CurrentCheckpointPriority = priority; } }
private void Start() { m_Tower = GetComponent <TowerBase>(); m_TowerHost = GetComponent <TowerHost>(); }