/** * Deletes the current target and thereby cancels the planned attack */ public void ClearTarget() { ////Debug.Log ("Someone cleared the targets."); foreach (string targetToRemove in Targets.Keys) { GameObject tmp = GuidList.GetGameObject(targetToRemove); // Check if the target has been destroyed if (tmp != null) { // If it wasn't // Turn its targeted pulse off since the attack targeting it // has been canceled or executed. tmp.transform.FindChild("Attack Pulse").gameObject.SetActive(false); } } this.Targets.Clear(); CurShotsTargeted = 0; UIUnitInspectorController UIUnit = GameObject.Find("Canvas").GetComponent <UIUnitInspectorController>() as UIUnitInspectorController; if (UIUnit != null) { UIUnit.ClearTargets(); } }
/** * Governs what happens when the unit dies. * * This will call the destroy method of the parent class, * but throretically we could make it a special unit like a base that * drops something when it is destroyed. */ public virtual void KillUnit() { GameObject Canvas = GameObject.Find("Canvas"); UIUnitInspectorController Inspector = Canvas.GetComponent <UIUnitInspectorController> (); if (Inspector != null) { Inspector.StopInspecting(); } if (NetworkManager.NetworkInstance.IsServer) { NetworkManager.NetworkInstance.DestroyUnitOnNetwork(gameObject); } }