示例#1
0
        override public void findPlate(int direction)
        {
            Direction playerDir = Game.FindTargetDirection(Target, this);

            if (IsScared)
            {
                playerDir = (Direction)((int)(playerDir + 2) % 4);
            }
            if (CurrentPlate.diretions[(int)playerDir].Passable)
            {
                nextPlate = CurrentPlate.diretions[(int)playerDir];
                Direction = playerDir;
            }
            else if (CurrentPlate.diretions[direction].Passable)
            {
                nextPlate = CurrentPlate.diretions[direction];
                return;
            }
            else
            {
                for (int i = 0; i < 4; i++)
                {
                    if (i != direction && CurrentPlate.diretions[i].Passable)
                    {
                        if (IsScared && i == (int)Game.FindTargetDirection(Target, this))
                        {
                            continue;
                        }
                        nextPlate = CurrentPlate.diretions[i];
                        Direction = (Direction)i;
                    }
                }
            }
        }
示例#2
0
 public virtual void findPlate(int direction)
 {
     if (!IsScared || (IsScared && direction != (int)Game.FindTargetDirection(Target, this)))
     {
         if (CurrentPlate.diretions[direction].Passable)
         {
             nextPlate = CurrentPlate.diretions[direction];
             return;
         }
     }
     for (int i = 0; i < 4; i++)
     {
         if (i != (direction + 2) % 4 && CurrentPlate.diretions[i].Passable)
         {
             nextPlate = CurrentPlate.diretions[i];
             Direction = (Direction)i;
             return;
         }
     }
 }