Beispiel #1
0
 /* If the player wants to tackle another player, the new target point will be the location the tackled player will
  * have in the amount of rounds which this player needs to get to the current position of the players he wants to tackle. */
 public void UpdateTargetPoint(Point currentLocation, int speed)
 {
     if(Type == ActionType.Tackle && AffectedPlayer != null)
     {
         Pathfinding distanceCalcer = new Pathfinding();
         ActionType type;
         int distance = (int) Pathfinding.DistanceBetweenPoints(currentLocation, AffectedPlayer.Location);
         Point target = distanceCalcer.PlayerAtSpecificRound(AffectedPlayer, distance / speed, out type);
         TargetPointChanged = target != TargetPoint;
         TargetPoint = target;
     }
 }
Beispiel #2
0
 /* Returns the last point where the player will go to in the next round.  */
 private Point GetAffectedPoint(Player player)
 {
     Pathfinding pathfinding = new Pathfinding();
     ActionType type;
     return pathfinding.PlayerAtSpecificRound(player, 1, out type);
 }
Beispiel #3
0
        /// <summary>
        /// Checks whether a player stands at the location at the moment and will stand on it in the next round as well. 
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        private Player StandsPlayerOnLocation(Point location)
        {
            Pathfinding pathfinding = new Pathfinding();
            Player foundPlayer = null;
            gameAI.AllPlayers.ToList().ForEach(x =>
            {
                if (x.Location == location)
                {
                    ActionType type;
                    Point nextRoundLocation = pathfinding.PlayerAtSpecificRound(x, 1, out type);
                    if (nextRoundLocation == location)
                    {
                        foundPlayer = x;
                    }
                }
            });

            return foundPlayer;
        }