private void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.layer == LayerMask.NameToLayer("Block")) { baseBlock otherBB = other.gameObject.GetComponent <baseBlock>(); hitAmnt -= 1; otherBB.currentHealth -= 1; otherBB.UpdateHealth(); if (otherBB.currentHealth <= 0) { randomChance = Random.Range(0, 1); if (randomChance >= 0.5) { hitAmnt++; } } } if (other.gameObject.tag == "Player") { Physics2D.IgnoreCollision(other.gameObject.GetComponent <Collider2D>(), GetComponent <Collider2D>()); Destroy(gameObject); GameManager.GMInstance.isProjectile = false; } }
public void TriggerPower(baseBlock teleporter, GameObject trigger) { if (teleporter.isPowered) { trigger.SetActive(true); } else { trigger.SetActive(false); } }