Exemplo n.º 1
0
 /// <summary>
 /// 決定可否瞬間移動,可以則transportPos為瞬間移動後的位置
 /// </summary>
 /// <param name="creature">生物種類</param>
 /// <param name="pos">位置</param>
 /// <param name="transportPos">瞬間移動後位置</param>
 public bool CanTransport(Creature creature, IVector2 pos, out IVector2 transportPos)
 {
     transportPos = pos.Clone();
     if (!CheckPosLegal(pos))
     {
         return(false);
     }
     if (creature != Creature.Scarab || allMapBlock[pos.x][pos.y].MapBlockType != BlockType.Hole)
     {
         return(false);
     }
     if (holePos == null || !holePos.ContainsKey(pos.DataToUInt()))
     {
         return(false);
     }
     else
     {
         transportPos = holePos[pos.DataToUInt()].Clone();
         if (!CheckPosLegal(transportPos))
         {
             return(false);
         }
         if (allMapBlock[transportPos.x][transportPos.y].LivingObject != Creature.None)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
 }