private void InitAi() { bool aiP1 = PlayerPrefs.GetString("Player1_AI").Equals("True"); bool aiP2 = PlayerPrefs.GetString("Player2_AI").Equals("True"); bool aiP3 = PlayerPrefs.GetString("Player3_AI").Equals("True"); bool aiP4 = PlayerPrefs.GetString("Player4_AI").Equals("True"); if (aiP1) { PlayerInput input = p1.GetComponent <PlayerInput>(); PlayerInput inputMarker = p1.marker.GetComponent <PlayerInput>(); Destroy(input); Destroy(inputMarker); p1.SetAiControlled(true); p1.SetWall(activeWall); } if (aiP2) { PlayerInput input = p2.GetComponent <PlayerInput>(); PlayerInput inputMarker = p2.marker.GetComponent <PlayerInput>(); Destroy(input); Destroy(inputMarker); p2.SetAiControlled(true); p2.SetWall(activeWall); } if (aiP3) { PlayerInput input = p3.GetComponent <PlayerInput>(); PlayerInput inputMarker = p3.marker.GetComponent <PlayerInput>(); Destroy(input); Destroy(inputMarker); p3.SetAiControlled(true); p3.SetWall(activeWall); } if (aiP4) { PlayerInput input = p4.GetComponent <PlayerInput>(); PlayerInput inputMarker = p4.marker.GetComponent <PlayerInput>(); Destroy(input); Destroy(inputMarker); p4.SetAiControlled(true); p4.SetWall(activeWall); } }
private void SetAi(CannonPlayer player, bool ai) { if (ai) { PlayerInput input = player.GetComponent<PlayerInput>(); PlayerInput inputMarker = player.marker.GetComponent<PlayerInput>(); Destroy(input); Destroy(inputMarker); player.SetAiControlled(true); player.SetWall(activeWall); } }