예제 #1
0
 private void Map_MapMovement(GameMapMovementMessage message)
 {
     if (message.ActorId != _account.Character.Id)
     {
         return;                                           // packet doesn't match the move requested.
     }
     Console.WriteLine($"Receiving[GameMapMovementMessage] Destination {message.KeyMovements[message.KeyMovements.Count-1]}");
     _account.Character.Map.MapMovement -= Map_MapMovement;
     if (_account.Character.Status != CharacterStatus.Fighting)
     {
         _account.PerformAction(() =>
         {
             _account.Network.SendToServer(new GameMapMovementConfirmMessage());
             OnMovementFinished(true);
         },
                                (int)MovementVelocity.GetPathVelocity(_path,
                                                                      _path.Cells.Count >= 4
                     ? MovementVelocity.MovementTypeEnum.WALKING
                     : MovementVelocity.MovementTypeEnum.RUNNING));
     }
     else
     {
         OnMovementFinished(true);
     }
 }
예제 #2
0
        private void Map_MapMovement(GameMapMovementMessage message)
        {
            if (message.ActorId != _account.Character.Id || message.KeyMovements[0] != _path.CellStart.CellId)
            {
                return;
            }
            _account.Character.Map.MapMovement -= Map_MapMovement;
            _account.Character.Status           = CharacterStatus.Moving;

            MovementVelocity.MovementTypeEnum type;
            if (_path.Cells.Count >= 4) // Need check pods
            {
                type = MovementVelocity.MovementTypeEnum.WALKING;
            }
            else
            {
                type = MovementVelocity.MovementTypeEnum.RUNNING;
            }

            var time = MovementVelocity.GetPathVelocity(_path, type);

            _account.PerformAction(() =>
            {
                _account.Network.SendToServer(new GameMapMovementConfirmMessage());
                OnMovementFinished(true);
            }, (int)time);
        }
예제 #3
0
        /// <summary>
        /// fetches the momentum of the entity based on current movement velocity and mass.
        /// </summary>
        /// <returns>momentum of the entity.</returns>
        public float GetMomentum()
        {
            float momentum = GameData.Instance.PhysicsConstants.MomentumMultiplier * MovementVelocity.Length() * Mass;

            return(momentum);
        }