Esempio n. 1
0
        public void FireAt(Vector2 screenPoint)
        {
            if (this.LoadedWeapon == null)
            {
                return;
            }

            float      screenDistance = 9999f;
            GameObject target         = null;

            for (int i = 0; i < this.Hostiles.Count; i++)
            {
                Damageable hostile = this.Hostiles[i];
                if ((hostile == null) || hostile.IsDead())
                {
                    continue;
                }
                bool inFireArc = this.IsInFireArc(this.LoadedWeapon, hostile.gameObject);
                if (inFireArc)
                {
                    Vector3 screenPos = Camera.main.WorldToViewportPoint(hostile.transform.position);
                    float   dist      = Vector3.Distance(screenPos, screenPoint);
                    if (dist < screenDistance)
                    {
                        target = hostile.gameObject;
                    }
                }
            }

            this.LoadedWeapon.FireAt(target);
        }
Esempio n. 2
0
        public override bool IsConditionMet()
        {
            bool allDead = true;

            for (int i = 0; i < this.Damagables.Length; i++)
            {
                Damageable d = this.Damagables[i];
                if ((d != null) && !d.IsDead())
                {
                    allDead = false;
                    break;
                }
            }
            return(allDead);
        }
Esempio n. 3
0
 private static bool IsDamageableDead(Damageable damageable)
 {
     return(damageable.IsDead());
 }