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 Start() { thisPerk = this.gameObject; thisRigidbody = this.GetComponent <Rigidbody2D>(); inGameSystemObj = GameObject.FindWithTag("System"); gameSystemScript = inGameSystemObj.GetComponent <inGameSystem>(); situation = 0; if (whatPerk == 2) { beaconCollider = this.GetComponent <BoxCollider2D>(); beaconCollider.enabled = false; this.transform.DOScale(3.0f, 0.0f); this.transform.DOScale(6.5f, 2.5f); ParticleSystem tempParticleObj = GetComponentInChildren <ParticleSystem>(); tempParticleObj.transform.DOScale(3.0f, 0.0f); tempParticleObj.transform.DOScale(6.5f, 2.5f); } }
private void Associate() { inGameSystemObj = GameObject.FindGameObjectWithTag("System"); inGameSystemScrypt = inGameSystemObj.GetComponent <inGameSystem>(); playerControllerScript = this.GetComponent <playerController>(); if (whatPlayer == 1) { perkTextObj = GameObject.Find("PerkTextShip1"); perkText = perkTextObj.GetComponent <TextMeshProUGUI>(); burstParticleSystem = GameObject.Find("BurstParticleShip1").GetComponent <ParticleSystem>(); } else if (whatPlayer == 2) { perkTextObj = GameObject.Find("PerkTextShip2"); perkText = perkTextObj.GetComponent <TextMeshProUGUI>(); burstParticleSystem = GameObject.Find("BurstParticleShip2").GetComponent <ParticleSystem>(); } }