public override IEnumerator RunRoutine() { while (true) { if (ShouldJump()) { yield return(_jump.Execute()); } else { yield return(_roll.Execute()); } StepFinished(); } }
public override IEnumerator RunRoutine() { while (true) { yield return(_roll.Execute()); var shouldRollSideWays = Random.Range(0f, 1f) < _chanceToRollSideways; if (shouldRollSideWays) { _roll.RollDirection = Random.Range(0f, 1f) < 0.5f ? RollMove.Direction.Left : RollMove.Direction.Right; } else { _roll.RollDirection = RollMove.Direction.Forward; } StepFinished(); } }