public void TurnByKeyPress(Key key)
 {
     if (ActiveMovement != null)
     {
         ActiveMovement.IsCharacterTurning = true;
     }
     ActiveMovement?.TurnByKeyPress(key);
 }
Exemplo n.º 2
0
        private void SetMovement()
        {
            currentMovement = activeMovements[movementsIndexRandomList[movementCount]];
            lblCurrentMovement.BeginInvoke(
                new Action(() => { lblCurrentMovement.Text = currentMovement.Name; })
                );
            int count = movementCount + 1;

            lblMovementCount.BeginInvoke(
                new Action(() => { lblMovementCount.Text = count.ToString(); })
                );
        }
 public async Task ExecuteKnockback(List <MovableCharacter> charactersBeingKnockedback, double distance)
 {
     if (ActiveMovement == null)
     {
         if (DefaultMovements.CurrentActiveMovementForMovingCharacters != null && this.Movements.Any(m => m.Name == DefaultMovements.CurrentActiveMovementForMovingCharacters.Name))
         {
             Movements.Active = this.Movements.First(m => m.Name == DefaultMovements.CurrentActiveMovementForMovingCharacters.Name);
         }
         else
         {
             Movements.Active = DefaultMovement;
         }
     }
     await ActiveMovement?.ExecuteKnockback(charactersBeingKnockedback, distance);
 }
 public void TurnTowardDestination(Position destination)
 {
     if (ActiveMovement == null)
     {
         if (DefaultMovements.CurrentActiveMovementForMovingCharacters != null && this.Movements.Any(m => m.Name == DefaultMovements.CurrentActiveMovementForMovingCharacters.Name))
         {
             Movements.Active = this.Movements.First(m => m.Name == DefaultMovements.CurrentActiveMovementForMovingCharacters.Name);
         }
         else
         {
             Movements.Active = DefaultMovement;
         }
     }
     ActiveMovement?.TurnTowardDestination(destination);
 }
 public void Turn(TurnDirection direction, double angle = 5)
 {
     if (ActiveMovement == null)
     {
         if (DefaultMovements.CurrentActiveMovementForMovingCharacters != null && this.Movements.Any(m => m.Name == DefaultMovements.CurrentActiveMovementForMovingCharacters.Name))
         {
             Movements.Active = this.Movements.First(m => m.Name == DefaultMovements.CurrentActiveMovementForMovingCharacters.Name);
         }
         else
         {
             Movements.Active = DefaultMovement;
         }
     }
     ActiveMovement.IsCharacterTurning = true;
     ActiveMovement?.Turn(direction, angle);
 }
 public void MoveForwardTo(Position destination)
 {
     if (ActiveMovement == null)
     {
         if (DefaultMovements.CurrentActiveMovementForMovingCharacters != null && this.Movements.Any(m => m.Name == DefaultMovements.CurrentActiveMovementForMovingCharacters.Name))
         {
             Movements.Active = this.Movements.First(m => m.Name == DefaultMovements.CurrentActiveMovementForMovingCharacters.Name);
         }
         else
         {
             Movements.Active = DefaultMovement;
         }
     }
     ActiveMovement.IsCharacterMovingToDestination = true;
     ActiveMovement.MoveForwardTo(destination);
 }
 public void Move(Direction direction, Position destination = null)
 {
     if (ActiveMovement == null)
     {
         if (DefaultMovements.CurrentActiveMovementForMovingCharacters != null && this.Movements.Any(m => m.Name == DefaultMovements.CurrentActiveMovementForMovingCharacters.Name))
         {
             Movements.Active = this.Movements.First(m => m.Name == DefaultMovements.CurrentActiveMovementForMovingCharacters.Name);
         }
         else
         {
             Movements.Active = DefaultMovement;
         }
     }
     ActiveMovement.IsCharacterMovingToDestination = destination != null;
     ActiveMovement.Move(direction, destination);
 }
 public void MoveByKeyPress(Key key)
 {
     ActiveMovement.IsCharacterMovingToDestination = false;
     ActiveMovement.MoveByKeyPress(key);
 }