void OnTriggerEnter2D(Collider2D coll) { if (coll.gameObject.tag == "Player") { Destroy(this.gameObject); playerAttack = coll.GetComponent<PlayerAttackScript>(); playerAudioSource = coll.GetComponent<AudioSource>(); playerAudioSource.PlayOneShot(playerAttack.pickUpSound); if (thisPower == "Freeze") { playerAttack.freezePowerReady = true; } else if (thisPower == "Wind") { playerAttack.windPowerReady = true; } else if (thisPower == "Speed") { playerAttack.speedPowerReady = true; } else if (thisPower == "Shield") { playerAttack.shieldPowerReady = true; } } }
// Use this for initialization void Start() { characterstats = gameObject.GetComponent <CharacterStatsScript> (); playerAttack = gameObject.GetComponent <PlayerAttackScript> (); Temp_DodgeSpeed = characterstats.DodgeSpeed; }
// Use this for initialization void Start () { playerAttackScript = GetComponent<PlayerAttackScript> (); spriteUI.gameObject.SetActive (false); }
// Use this for initialization void Start() { playerAttackScript = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerAttackScript> (); }