Beispiel #1
0
 /// <summary>
 ///     Passes friendly only.
 /// </summary>
 public void PassFriendlyOnly(LogicGameObject gameObject)
 {
     if (gameObject.GetHitpointComponent() != null)
     {
         this._team      = gameObject.GetHitpointComponent().GetTeam();
         this._enemyOnly = false;
     }
     else
     {
         this._team = -1;
     }
 }
Beispiel #2
0
        /// <summary>
        ///     Test the specified gameobject.
        /// </summary>
        public virtual bool TestGameObject(LogicGameObject gameObject)
        {
            if (this._gameObjectTypes != null)
            {
                if (!this._gameObjectTypes[gameObject.GetGameObjectType()])
                {
                    return(false);
                }
            }

            if (this._ignoreGameObjects != null)
            {
                for (int i = 0; i < this._ignoreGameObjects.Count; i++)
                {
                    if (this._ignoreGameObjects[i] == gameObject)
                    {
                        return(false);
                    }
                }
            }

            if (this._team != -1)
            {
                LogicHitpointComponent hitpointComponent = gameObject.GetHitpointComponent();

                if (hitpointComponent != null)
                {
                    bool isEnemy = hitpointComponent.IsEnemyForTeam(this._team);

                    if (gameObject.IsAlive())
                    {
                        if (isEnemy || !this._enemyOnly)
                        {
                            return(!this._enemyOnly || !isEnemy);
                        }
                    }

                    return(false);
                }
            }

            return(true);
        }