public override void OnProjectileHit(F3DProjectile projectile, GameObject obj, Vector3 hitPoint) { DogFight.Damageable damageable = obj.GetComponent <DogFight.Damageable>(); //Debug.LogError("WeaponFXController OnProjectileHit name=" + obj.name + " rootName=" + obj.transform.root.gameObject.name + " damageable=" + damageable); if (damageable != null) { damageable.Damage(projectile.damage); } }
protected void ScanForHostiles() { for (int i = 0; i < Damageable.Damageables.Count; i++) { Damageable d = Damageable.Damageables[i]; if ((d == null) || !FactionController.Instance.IsHostile(this.Faction, d.GetFaction())) { continue; } if (!this.Hostiles.Contains(d)) { this.Hostiles.Add(d); } } this.Hostiles.RemoveAll(this.IsDamageableDead); }
public void OnHit(GameObject target) { Damageable dam = target.GetComponent <Damageable>(); if (dam != null) { OnHit(dam); return; } Damageable parentDam = target.GetComponentInParent <Damageable>(); if (parentDam != null) { OnHit(parentDam); return; } }
private static bool IsDamageableDead(Damageable damageable) { return(damageable.IsDead()); }