void Start() { ChangePuck = FindObjectOfType <ChangePuck>(); if (NewGame.mode == NewGame.GameMode.Singleplayer) { PlayerMarkBehaviour = GameObject.FindGameObjectWithTag("PlayerMark").GetComponent <MarkBehaviour>(); EnemyMarkBehaviour = GameObject.FindGameObjectWithTag("EnemyMark").GetComponent <MarkBehaviour>(); EnemyPointer = FindObjectOfType <EnemyPointer>(); PlayerPointer = FindObjectOfType <RotatePointerWithMouse>(); ShootPuck = FindObjectOfType <ShootPuck>(); EnemyAI = FindObjectOfType <EnemyAI>(); EnemyShootPuck = FindObjectOfType <EnemyShootPuck>(); } else if (NewGame.mode == NewGame.GameMode.LocalMultiplayer) { ShootPuck2 = GameObject.FindGameObjectWithTag("PucksP2").GetComponent <ShootPuck>(); ShootPuck1 = GameObject.FindGameObjectWithTag("PucksP1").GetComponent <ShootPuck>(); Player2MarkBehaviour = GameObject.FindGameObjectWithTag("Player2Mark").GetComponent <MarkBehaviour>(); Player1MarkBehaviour = GameObject.FindGameObjectWithTag("Player1Mark").GetComponent <MarkBehaviour>(); Player1RotatePointer = GameObject.FindGameObjectWithTag("PlayerPointer").GetComponent <RotatePointerAxis>(); Player2RotatePointer = GameObject.FindGameObjectWithTag("Player2Pointer").GetComponent <RotatePointerAxis>(); } else if (NewGame.mode == NewGame.GameMode.Multiplayer) { } }
public override void Start() { base.Start(); ShootPuck = FindObjectOfType <ShootPuck>(); ChangePuck.ActiveEnemyPuck = Random.Range(0, ChangePuck.EnemyPuckList.Count); // ShootPuck.puck = MarkBehaviour.target.GetComponent<Rigidbody>(); }
private void Start() { if (NewGame.mode == NewGame.GameMode.Singleplayer) { shootPuck = FindObjectOfType <ShootPuck>(); EnemyAi = FindObjectOfType <EnemyAI>(); RotatePointerWithMouse = FindObjectOfType <RotatePointerWithMouse>(); } else if (NewGame.mode == NewGame.GameMode.LocalMultiplayer) { ShootPuck = FindObjectsOfType <ShootPuck>(); } Setup(); }
void Setup(Scene scene, LoadSceneMode mode) { endGamePanel = GameObject.FindGameObjectWithTag("End"); changePuck = FindObjectOfType <ChangePuck>(); textControl = FindObjectOfType <TextControl>(); won = false; textControl.SpritesOfNumbers[5] = textControl.RoundSprites[roundNumber]; if (NewGame.mode == NewGame.GameMode.Singleplayer) { markBehaviour = FindObjectsOfType <MarkBehaviour>(); enemyShootPuck = FindObjectOfType <EnemyShootPuck>(); shootPuck = FindObjectOfType <ShootPuck>(); enemyAI = FindObjectOfType <EnemyAI>(); } else if (NewGame.mode == NewGame.GameMode.LocalMultiplayer) { markBehaviour = FindObjectsOfType <MarkBehaviour>(); localShootPuck = FindObjectsOfType <ShootPuck>(); } switch (winner) { case Winner.Player: playerWins++; winner = Winner.None; if (playerWins == 2) { endGamePanel.SetActive(true); text = endGamePanel.GetComponentInChildren <Text>(); textControl.gameObject.SetActive(false); markBehaviour[0].enabled = false; markBehaviour[1].enabled = false; shootPuck.enabled = false; enemyAI.enabled = false; enemyShootPuck.enabled = false; for (int i = 0; i < endGamePanel.transform.childCount; ++i) { endGamePanel.transform.GetChild(i).gameObject.SetActive(true); } text.text = "Player Wins"; } break; case Winner.Enemy: enemyWins++; winner = Winner.None; if (enemyWins == 2) { markBehaviour[0].enabled = false; markBehaviour[1].enabled = false; enemyAI.enabled = false; shootPuck.enabled = false; enemyShootPuck.enabled = false; endGamePanel.SetActive(true); textControl.gameObject.SetActive(false); for (int i = 0; i < endGamePanel.transform.childCount; ++i) { endGamePanel.transform.GetChild(i).gameObject.SetActive(true); } text = endGamePanel.GetComponentInChildren <Text>(); text.text = "Enemy Wins"; } break; case Winner.Player1: player1Wins++; winner = Winner.None; if (player1Wins == 2) { markBehaviour[0].enabled = false; markBehaviour[1].enabled = false; localShootPuck[0].enabled = false; localShootPuck[1].enabled = false; endGamePanel.SetActive(true); textControl.gameObject.SetActive(false); for (int i = 0; i < endGamePanel.transform.childCount; ++i) { endGamePanel.transform.GetChild(i).gameObject.SetActive(true); } text = endGamePanel.GetComponentInChildren <Text>(); text.text = "Player right wins"; } break; case Winner.Player2: player2Wins++; winner = Winner.None; if (player2Wins == 2) { markBehaviour[0].enabled = false; markBehaviour[1].enabled = false; localShootPuck[0].enabled = false; localShootPuck[1].enabled = false; endGamePanel.SetActive(true); textControl.gameObject.SetActive(false); for (int i = 0; i < endGamePanel.transform.childCount; ++i) { endGamePanel.transform.GetChild(i).gameObject.SetActive(true); } text = endGamePanel.GetComponentInChildren <Text>(); text.text = "Player left Wins"; } break; } }
public override void Start() { base.Start(); shootPuck = GameObject.FindGameObjectWithTag("PucksP2").GetComponent <ShootPuck>(); ChangePuck.ActivePlayerPuck = Random.Range(0, ChangePuck.PlayerPuckList.Count); }