void CreateBomb(GameObject bomb, bool special) { BombSP bombScript = bomb.GetComponent <BombSP>(); bombScript.owner = this; bombScript.playerController = playerController; bombScript.power = power; if (special) { bombScript.powerBomb = powerBomb; bombScript.triggerBomb = remoteBomb; } bombScript.SwapModel(); if (ghost) { Collider bombCollider = bomb.GetComponent <Collider>(); bombCollider.isTrigger = false; Physics.IgnoreCollision(bombCollider, character); } }
void OnTriggerEnter(Collider other) { print("Projectile hit " + other.name); //ignore enemies, because only enemies can fire projectiles. if (other.CompareTag("Enemy")) { return; } HealthSP thingHit = other.GetComponent <HealthSP>(); if (thingHit != null) { if (destroysBlocks || other.gameObject.layer != 8) { thingHit.TakeDamage(1, false); } } BombSP daBomb = other.GetComponent <BombSP>(); if (daBomb != null && detonatesBombs) { Destroy(gameObject); daBomb.Explode(); } if (destroyOnHit) { Destroy(gameObject); } if (destroyOnBarriers && other.gameObject.layer == 8) { Destroy(gameObject); } }