コード例 #1
0
 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);
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
 private static bool IsDamageableDead(Damageable damageable)
 {
     return(damageable.IsDead());
 }