private RigidBodyControls player; //Referance to the player #endregion Fields #region Methods void Start() { player = GetComponent<RigidBodyControls>(); playerNumber = GetComponent<playerCharacter> ().ID; // Not the best way of doing this, but couldn't think of a clean, fast, robust way, that also accounted for // possible null refs if it tried to find the player before they spawned in if(playerNumber == 1) { dash = GameObject.Find("Txt_p1_Dashes").GetComponent<Text>(); dash.GetComponent<Text>().enabled = true; } else if(playerNumber == 2) { dash = GameObject.Find("Txt_p2_Dashes").GetComponent<Text>(); dash.GetComponent<Text>().enabled = true; } else if(playerNumber == 3) { dash = GameObject.Find("Txt_p3_Dashes").GetComponent<Text>(); dash.GetComponent<Text>().enabled = true; } else { dash = GameObject.Find("Txt_p4_Dashes").GetComponent<Text>(); dash.GetComponent<Text>().enabled = true; } }
// Use this for initialization void Start() { player = GetComponent<playerCharacter> (); rigid = GetComponent<RigidBodyControls> (); fire = transform.FindChild ("fire").gameObject; heal = transform.FindChild ("heal").gameObject; speed = transform.FindChild ("trail").gameObject; }
void Awake() { manager = GameObject.FindGameObjectWithTag ("GameController").GetComponent<gameController>(); controllerInput = GetComponent<XboxControls> (); Box = GetComponentInChildren<hitBox>(); Slam = GetComponentInChildren<slam> (); manager.players.Add (this); animator = GetComponentInChildren<Animator> (); spinning = GetComponentInChildren<fastHammerPhysics> (); rigidBody = GetComponent<RigidBodyControls> (); gravityValue = rigidBody.gravity; if (manager.settings != null) { lives = manager.settings.lives; } healthMax = health; stunParticles = transform.FindChild ("stun").gameObject; manager.alivePlayers.Add (this); soundEffect = GetComponent<playerSFX> (); myAudio = GetComponent<AudioSource> (); }