public void ExitCombat() { PlayerActivation playerActivation = this.GetComponent <PlayerActivation>(); playerActivation.Hide(); playerActivation.SetBehavioursEnabled(false); }
private void makeTeam(Team team, bool makePlayer) { CombatTeam combatTeam = new CombatTeam(); TeamTarget allies = TeamTarget.TargetJust(combatTeam); TeamTarget enemies = TeamTarget.TargetAllExcept(combatTeam); for (int i = 0; i < team.ShipCount; i++) { makeShip(team.Prefab, combatTeam, allies, enemies, new Vector3(team.Pos.x + Random.Range(-Dist, Dist), 0, team.Pos.z + Random.Range(-Dist, Dist))); } if (makePlayer) { // Make cursor MonoBehaviour.Instantiate(cursor, new Vector3(0, 0, 0), Quaternion.identity); // Reset player for start of combat. GameObject player = GameObject.FindGameObjectWithTag("ShipBlueprint"); player.transform.position = new Vector3(team.Pos.x + +Random.Range(-Dist, Dist), 0, team.Pos.z + Random.Range(-Dist, Dist)); player.transform.rotation = new Quaternion(0, 0, 0, 0); player.GetComponent <TeamMarker>().Team = combatTeam; player.GetComponent <TargetMarker>().AlliedTargets = allies; player.GetComponent <TargetMarker>().EnemyTargets = enemies; PlayerActivation activater = player.GetComponent <PlayerActivation>(); activater.Recreate(); activater.SetBehavioursEnabled(true); activater.Show(); } }
/* * TODO for version 3 * * add database feature. */ public void Start() { ShipPrefab = Instantiate(ShipPrefab) as GameObject; DontDestroyOnLoad(ShipPrefab); PlayerActivation activater = ShipPrefab.GetComponent <PlayerActivation>(); activater.Hide(); activater.SetBehavioursEnabled(false); activater.SetFactoriesEnabled(true); }
public void Update() { if (needsBuild) { PlayerActivation activater = ShipPrefab.GetComponent <PlayerActivation>(); needsBuild = false; AddBasicBuild(); activater.Recreate(); activater.SetBehavioursEnabled(false); activater.SetFactoriesEnabled(false); activater.Hide(); } }