void Walk() { if (!nextPoint.HasValue || this.transform.position == nextPoint) { if (nextPoint.HasValue) { pathToTarget.Remove(nextPoint.Value); } if (pathToTarget.Count == 0) { _State = States.Wait; return; } nextPoint = pathToTarget[0]; } switch (scr_Tilemap.Get.GetDirectionFromTo(this.transform.position, nextPoint.Value)) { case scr_Stats.Directions.Up: motor.MoveUp(); break; case scr_Stats.Directions.Right: motor.MoveRight(); break; case scr_Stats.Directions.Down: motor.MoveDown(); break; case scr_Stats.Directions.Left: motor.MoveLeft(); break; } }
void FreeMovement() { if (activeDirection != scr_Stats.Directions.None) { if ((activeDirection == scr_Stats.Directions.Up && !input.IsMovingUp()) || (activeDirection == scr_Stats.Directions.Right && !input.IsMovingRight()) || (activeDirection == scr_Stats.Directions.Down && !input.IsMovingDown()) || (activeDirection == scr_Stats.Directions.Left && !input.IsMovingLeft()) ) { activeDirection = scr_Stats.Directions.None; } } if (activeDirection == scr_Stats.Directions.None) { if (input.IsMovingUp()) { activeDirection = scr_Stats.Directions.Up; } else if (input.IsMovingRight()) { activeDirection = scr_Stats.Directions.Right; } else if (input.IsMovingDown()) { activeDirection = scr_Stats.Directions.Down; } else if (input.IsMovingLeft()) { activeDirection = scr_Stats.Directions.Left; } else { activeDirection = scr_Stats.Directions.None; } } if (input.IsInteracting()) { if (motor.Interact() == scr_Stats.Interaction.Altar) { SetState(States.HumanSelection); } } if (activeDirection != scr_Stats.Directions.None) { switch (activeDirection) { case scr_Stats.Directions.Up: motor.MoveUp(); break; case scr_Stats.Directions.Right: motor.MoveRight(); break; case scr_Stats.Directions.Down: motor.MoveDown(); break; case scr_Stats.Directions.Left: motor.MoveLeft(); break; } } }