Example #1
0
        public MoveResult MoveTo(Hex hex, bool forced)
        {
            if (inFlight) return MoveResult.AlreadyInFlight;
            if (AP <= 0) return MoveResult.NotEnoughActionPoints;
            if (hex.HasFigure && Owner == hex.Content.Owner) return MoveResult.BadDestination;

            this.forced = forced;
            currPath = GetPath(hex);

            if (currPath.Useful)
            {
                if (currPath.TotalCost > AP)
                    return MoveResult.NotEnoughActionPoints;
            }
            else
                return MoveResult.Impassable;

            ExecuteMove();
            return MoveResult.Ok;
        }
Example #2
0
 private bool MoveToPreviusHex()
 {
     currPath = GetPath(previousHex);
     if (currPath.Useful && currPath.Count == 1)
     {
         ExecuteMove();
         return true;
     }
     else
         return false;
 }
Example #3
0
        private void MoveToNearestEmptyHex()
        {
            currPath = GetPath(
                 passibilityCondition: (hex) =>
                {
                    if (hex.Content.Owner.IsEnemy(Owner))
                        return PassibilityType.AbsoluteObstacle;
                    else
                        return PassibilityType.Ok;
                },
                targetCondition: (hex) => { return !hex.HasFigure; });

            if (currPath.Useful)
                ExecuteMove();
            else
            {
                Debug.Log("oops!");
                Destroy();
            }
        }