void ItemDropCollect(Collider other) { if (itemDropType == "Shield01") { PlayerShields shield = other.GetComponent <PlayerShields>(); //Debug.Log(shield); if (shield != null) { shield.AdjustShieldPower(1); } } if (itemDropType == "Turrent01") { PlayerTurrents turrent = other.GetComponent <PlayerTurrents>(); //Debug.Log(turrent); if (turrent != null) { turrent.AdjustTurrentLevel(1); } } PlayCollisionExplosion(); Destroy(gameObject); }
void PlayerShieldCollision(Collider other) { if ((!other.CompareTag("Bolt")) && (!other.CompareTag("Item Drop"))) { PlayerShields shield = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerShields>(); //Debug.Log(shield); if (shield != null) { shield.AdjustShieldPower(-1); } PlayCollisionExplosion(); // Destroy enemy bolts and destroy a player turrent. if (other.CompareTag("Enemy Bolt")) { PlayerTurrents turrent = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerTurrents>(); turrent.AdjustTurrentLevel(-1); Destroy(other.gameObject); } } }