public override Message Execute()
        {
            Coords original = Actor.PositionGet();
            Coords current  = Actor.PositionGet();

            //Actor.MyMoveRangeCalculator.Cost(

            _drawer.AddMovementAnimation(Actor, _route);

            while (_route.Count > 0)
            {
                current = current.NeighborInDirection(_route[_route.Count - 1]);
                _route.RemoveAt(_route.Count - 1);
                Actor.PositionSet(current);
            }

            //this.Actor.AP -= this.APCost;
            (Actor as Creature).AddToStatBasic(Creature.StatBasic.AP, -_APCost);

            return(new Message(this.Actor.ToString() + " went from " + original.ToString() + " to " + current.ToString() + "."));
        }
Beispiel #2
0
        /// <summary>
        /// Enqueues the animation for a moving agent.
        /// </summary>
        public void AddMovementAnimation(Unit agent, List <Direction> route)
        {
            Coords current = agent.PositionGet();

            if (!_creatureAnimations.ContainsKey(agent.UniqueID))
            {
                _creatureAnimations.Add(agent.UniqueID, new List <AnimUnitMove>());
            }

            List <AnimUnitMove> moveStack = _creatureAnimations[agent.UniqueID];

            Coords nextGoal;

            for (int i = 0; i < route.Count; ++i)
            {
                nextGoal = current.NeighborInDirection(route[route.Count - 1 - i]);
                moveStack.Add(new AnimUnitMove(agent, Constants.AnimCreatureMoveBaseDuration, _creatures[(sbyte)agent.MyBitmap],
                                               _myInterface.HexPosition(current), _myInterface.HexPosition(nextGoal)));
                current = nextGoal;
            }
            moveStack.Reverse();
        }