void HandleCollision(GameObject other) { this.otherTag = other.tag; if (this.otherTag == "Obstacle" || this.otherTag == "Player" || this.otherTag == "Enemy") { stats.InflictDamage(int.MaxValue); } }
void HandleCollision(GameObject other) { if (playerOnly && other.tag != "Player") { return; } ElementStats stats = other.GetComponent <ElementStats>(); if (stats != null) { if (this.random) { if (Random.Range(0, 101) > 10) { damage = 0; } if (damage > 0 || Random.Range(0, 101) < 15) { armor = 0; } if (damage > 0 || Random.Range(0, 101) < 10) { this.heal = 0; } } if (this.armor > 0) { stats.RepairArmor(this.armor); } if (this.heal > 0) { stats.Heal(this.heal); } if (this.damage > 0) { stats.InflictDamage(this.damage); } if (this.fuel > 0) { stats.LoadFuel(this.fuel); } if (this.bullets > 0) { stats.ReloadBullets(this.bullets); } } gameObject.SetActive(false); }
private void HandleCollision(GameObject hitTarget) { ElementStats elementStats = hitTarget.GetComponent <ElementStats>(); if (elementStats != null && !elementStats.IsDead()) { elementStats.InflictDamage(this.damage); // TODO: add a small explosion for the bullet dissapearance. if (this.affectsScore && elementStats.IsDead()) { PlayerStats.AddGold(elementStats.gold); PlayerStats.AddScore(elementStats.scorePoints); } } SelfDestruct(); }