public override void Apply(ShotController controller, GameObject target) { DestructibleController destructible = target.GetComponent <DestructibleController>(); if (destructible) { if (destructible.GetDestructibleData().IsAffectedByDamageType(controller.GetDamageType())) { float damages = this.UsesPowerModificator ? controller.CalculatedValueAfterPowerModification(this.amountOfDamage) : this.amountOfDamage; destructible.TakeDamage(damages); GameObject.Destroy(controller.gameObject); } } }
public override void Apply(ShotController controller, GameObject target) { float damages = this.UsesPowerModificator ? controller.CalculatedValueAfterPowerModification(this.ExplosionDamageAmount) : this.ExplosionDamageAmount; Instantiate(this.ExplosionPrefab, controller.gameObject.transform.position, controller.gameObject.transform.rotation); // TODO Add damages to the explosion (atm, does nothing more than prefab instantiation and impact damage) DestructibleController destructible = target.GetComponent <DestructibleController>(); if (destructible) { if (destructible.GetDestructibleData().IsAffectedByDamageType(controller.GetDamageType())) { destructible.TakeDamage(damages); } } GameObject.Destroy(controller.gameObject); }