Esempio n. 1
0
        public override GameState Operate(GameState currentState)
        {
            GameState newState = currentState.Copy();
            IEnumerable <PathGraphVertex> path = PathGraph.FindShortestPath(currentState.Position, Game.Player.Position, false);
            float length   = PathGraph.GetLengthOfPath(path);
            float duration = length / Human.RunSpeed;

            newState.AddTime(TimeSpan.FromSeconds(duration));
            newState.Position = Game.Player.Position;
            newState.Damage  -= Game.Player.Health;
            newState.Health  -= Game.Player.Health * 0.9f;
            bool one = false;

            for (int i = 0; i < newState.QuarterStates.Length; i++)
            {
                if (newState.QuarterStates[i].Ownership == QuarterOwnership.His)
                {
                    if (one)
                    {
                        newState.QuarterStates[i].Ownership         = QuarterOwnership.Empty;
                        newState.QuarterStates[i].OwnershipDuration = TimeSpan.Zero;
                    }
                    one = true;
                }
            }
            return(newState);
        }
Esempio n. 2
0
 /// <summary>
 /// Recomputes the waypoints according to path graph to get to the task target.
 /// </summary>
 /// <param name="from">Start position</param>
 /// <param name="to">Destination position</param>
 protected void RecomputeWaypoints(PositionInTown from, PositionInTown to)
 {
     wayPoints.Clear();
     foreach (PathGraphVertex v in PathGraph.FindShortestPath(from, to, !(holder is Opponent)))
     {
         wayPoints.Enqueue(new WayPoint(v.Position));
     }
     wayPoints.Enqueue(new WayPoint(to));
 }
Esempio n. 3
0
        public override GameState Operate(GameState currentState)
        {
            IEnumerable <PathGraphVertex> path = PathGraph.FindShortestPath(currentState.Position, actionObject.Position, false);
            float     length   = PathGraph.GetLengthOfPath(path);
            GameState newState = currentState.Copy();
            float     duration = length / Human.RunSpeed;

            newState.AddTime(TimeSpan.FromSeconds(duration));
            newState.Position = actionObject.Position;
            return(newState);
        }
Esempio n. 4
0
        public override GameState Operate(GameState currentState)
        {
            IEnumerable <PathGraphVertex> path = PathGraph.FindShortestPath(currentState.Position, box.Position, false);
            float     length   = PathGraph.GetLengthOfPath(path);
            GameState newState = currentState.Copy();
            float     duration = length / Human.RunSpeed;

            newState.AddTime(TimeSpan.FromSeconds(duration));
            if (box is ToolBox)
            {
                GunType gunType = Game.BoxDefaultGuns[Game.Random.Next(Game.BoxDefaultGuns.Count)];
                newState.Damage += gunType.Damage * gunType.DefaultBulletCount;
            }
            else
            {
                newState.Health = 100;
            }
            newState.Position = box.Position;
            return(newState);
        }