void AssociateGameObjects() { if (player == 1) { playerCameraText1 = GameObject.Find("TextShip1"); scoreText = playerCameraText1.GetComponent <TextMeshProUGUI>(); yourShip = GameObject.Find("Player1Ship"); anotherShip = GameObject.Find("Player2Ship"); playerCameraText2 = GameObject.Find("VelocityShip1"); velocityText = playerCameraText2.GetComponent <TextMeshProUGUI>(); } else if (player == 2) { playerCameraText1 = GameObject.Find("TextShip2"); scoreText = playerCameraText1.GetComponent <TextMeshProUGUI>(); yourShip = GameObject.Find("Player2Ship"); anotherShip = GameObject.Find("Player1Ship"); playerCameraText2 = GameObject.Find("VelocityShip2"); velocityText = playerCameraText2.GetComponent <TextMeshProUGUI>(); } else { Debug.Log("Association Error"); } yourOriginalPosition = this.transform.position; inGameSystemObj = GameObject.FindWithTag("System"); gameSystemScript = inGameSystemObj.GetComponent <inGameSystem>(); playerPerkScript = this.GetComponent <perkSystem>(); }
void AssociateShips() { playerOneShip = GameObject.FindWithTag("PlayerOne"); playerTwoShip = GameObject.FindWithTag("PlayerTwo"); playerOneScript = playerOneShip.GetComponent <playerController>(); playerTwoScript = playerTwoShip.GetComponent <playerController>(); playerOnePerkSystemScript = playerOneShip.GetComponent <perkSystem>(); playerTwoPerkSystemScript = playerTwoShip.GetComponent <perkSystem>(); botCollider = GameObject.Find("BotCollider"); topCollider = GameObject.Find("TopCollider"); }