示例#1
0
 void updateSelectionIsAvailable()
 {
     if (this._selectedPosition.isEqualTo(this._homePosition) || this._selectedPosition.isEqualTo(this._doorPosition))
     {
         this.setSelectionIsAvailable(false);
     }
     else
     {
         DefenseScript d;
         if (CreateDefensesScript.sharedInstance().anyDefenseAtPosition(this._selectedPosition, out d))
         {
             this.setSelectionIsAvailable(false);
         }
         else
         {
             ArrayList pathPositions;
             if (PathScript.sharedInstance().existsPathFromPosToPosIfBlockingPosition(this.getDoorPosition(), this.getHomePosition(), this._selectedPosition, out pathPositions))
             {
                 this.setSelectionIsAvailable(true);
             }
             else
             {
                 this.setSelectionIsAvailable(false);
             }
         }
     }
 }
示例#2
0
    public bool tryToBlockPosition(Position pos)
    {
        DefenseScript defense;
        bool          anyDefense = CreateDefensesScript.sharedInstance().anyDefenseAtPosition(pos, out defense);

        if (anyDefense)
        {
            return(false);
        }
        else
        {
            bool pathCanBlockPosition = PathScript.sharedInstance().blockPosition(pos);
            return(pathCanBlockPosition);
        }
    }
示例#3
0
    private bool positionIsBlocked(Position pos)
    {
        bool blockedBySelf = false;
        bool anyDefense    = false;

        if (this._blockedPositions != null)
        {
            int i = 0;
            while (!blockedBySelf && i < this._blockedPositions.Count)
            {
                Position next = (Position)this._blockedPositions [i];
                blockedBySelf = pos.isEqualTo(next);
                i++;
            }
        }

        if (!blockedBySelf)
        {
            DefenseScript def;
            anyDefense = CreateDefensesScript.sharedInstance().anyDefenseAtPosition(pos, out def);
        }

        return(blockedBySelf || anyDefense);
    }
 void OnDestroy()
 {
     singleton = null;
 }
 void Awake()
 {
     singleton = this;
 }
示例#6
0
 void OnDestroy()
 {
     singleton = null;
 }
示例#7
0
 void Awake()
 {
     singleton = this;
 }