Esempio n. 1
0
        /// <summary>
        /// Initialisation.
        /// </summary>
        public override void Initialize()
        {
            var anim = new AnimProcess(unit, AnimAction.Walk, true);
            ClientGame._processManager.ProcessList.Add(anim);

            MovementProcess lastMove = null;

            for( int i = 0; i < path.Length; i ++)
            {
                MovementProcess walk;
                if (i == path.Length - 1)
                {
                    walk = new MovementProcess(unit, path[i], anim, iso);
                    walk.Next = Next;
                }
                else
                    walk = new MovementProcess(unit, path[i], null, iso);

                if (lastMove != null)
                    lastMove.Next = walk;
                else
                    ClientGame._processManager.ProcessList.Add(walk);
                lastMove = walk;  
            }
            //  If we were previously idle - stop any existing animations
            ClientGame._processManager.ClearAnimations(unit);
            ClientGame._processManager.ProcessList.Remove(this);
        }
Esempio n. 2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="unit"></param>
 /// <param name="direction"></param>
 /// <param name="linkedAnimProcess"></param>
 /// <param name="delay"></param>
 public MovementProcess(Unit unit, CompassDirection direction, AnimProcess linkedAnimProcess, Isometry iso, float delay = .015f)
     : base()
 {
     _unit = unit;
     _direction = direction;
     _linkedAnimProcess = linkedAnimProcess;
     _speed = delay;
     _iso = iso;
 }