// Update is called once per frame void Update() { if (Health <= 0) { GameObject camera = GameObject.FindGameObjectWithTag("CommanderCamera"); CommanderLogic cameraScripts = camera.GetComponent("CommanderLogic") as CommanderLogic; cameraScripts.RemoveTankFromArray(this.gameObject); } }
public RTSCameraLogic() { CommanderLogic = new CommanderLogic(this); DisableDeathLogic = new DisableDeathLogic(this); FixScoreBoardAfterPlayerDeadLogic = new FixScoreBoardAfterPlayerDeadLogic(this); MissionSpeedLogic = new MissionSpeedLogic(this); SwitchFreeCameraLogic = new SwitchFreeCameraLogic(this); SwitchTeamLogic = new SwitchTeamLogic(this); ControlTroopLogic = new ControlTroopLogic(this); }
void OnCollisionEnter(Collision col) { if (PhotonNetwork.player.GetTeam() == PunTeams.Team.red) { if (col.gameObject.CompareTag("BlueUnitShell")) { Health -= 20; } if (col.gameObject.CompareTag("BlueShell")) { Health -= 10; } if (col.gameObject.CompareTag("BlueStunShell")) { GameObject camera = GameObject.FindGameObjectWithTag("CommanderCamera"); CommanderLogic cameraScripts = camera.GetComponent("CommanderLogic") as CommanderLogic; cameraScripts.SetStunned(true); } } if (PhotonNetwork.player.GetTeam() == PunTeams.Team.blue) { if (col.gameObject.CompareTag("RedUnitShell")) { Health -= 20; } if (col.gameObject.CompareTag("RedShell")) { Health -= 10; } if (col.gameObject.CompareTag("RedStunShell")) { GameObject camera = GameObject.FindGameObjectWithTag("CommanderCamera"); CommanderLogic cameraScripts = camera.GetComponent("CommanderLogic") as CommanderLogic; cameraScripts.SetStunned(true); } } }