public AnimationDrivenLocomotion(
            AnimationTree animationTree,
            Skeleton skeleton,
            AnimationStates states,
            Blender2D blender,
            TimeScale timeScale,
            string idleState,
            string moveState,
            KinematicBody target,
            Physics3DSettings physicsSettings,
            ITimeSource timeSource,
            bool active,
            ILoggerFactory loggerFactory) : base(target, physicsSettings, timeSource, active, loggerFactory)
        {
            Ensure.That(animationTree, nameof(animationTree)).IsNotNull();
            Ensure.That(skeleton, nameof(skeleton)).IsNotNull();
            Ensure.That(states, nameof(states)).IsNotNull();
            Ensure.That(blender, nameof(blender)).IsNotNull();
            Ensure.That(timeScale, nameof(timeScale)).IsNotNull();
            Ensure.That(idleState, nameof(idleState)).IsNotNullOrEmpty();
            Ensure.That(moveState, nameof(moveState)).IsNotNullOrEmpty();

            AnimationTree = animationTree;
            Skeleton      = skeleton;
            States        = states;
            Blender       = blender;
            TimeScale     = timeScale;
            IdleState     = idleState;
            MoveState     = moveState;
        }
 protected override Validation <string, AnimationDrivenLocomotion> CreateService(
     KinematicBody target,
     Physics3DSettings physicsSettings,
     ILoggerFactory loggerFactory)
 {
     return
         (from manager in AnimationManager
          .ToValidation("Failed to find the animation manager.")
          from skeleton in Skeleton
          .ToValidation("Failed to find the skeleton.")
          from states in StatesPath.TrimToOption().Bind(manager.FindStates)
          .ToValidation($"Unable to find an AnimationStates control at '{StatesPath}'.")
          from blender in Blend2DPath.TrimToOption().Bind(manager.FindBlender2D)
          .ToValidation($"Unable to find a Blender2D control at '{Blend2DPath}'.")
          from timeScale in TimeScalePath.TrimToOption().Bind(manager.FindTimeScale)
          .ToValidation($"Unable to find a TimeScale control at '{TimeScalePath}'.")
          from idleState in IdleState.TrimToOption()
          .ToValidation("Idle state value was not specified.")
          from moveState in MoveState.TrimToOption()
          .ToValidation("Move state value was not specified.")
          select new AnimationDrivenLocomotion(
              manager.AnimationTree,
              skeleton,
              states,
              blender,
              timeScale,
              idleState,
              moveState,
              target,
              physicsSettings,
              this,
              Active,
              loggerFactory));
 }
Beispiel #3
0
        protected KinematicLocomotion(
            KinematicBody target,
            Physics3DSettings physicsSettings,
            ITimeSource timeSource,
            bool active,
            ILoggerFactory loggerFactory) : base(target, timeSource, active, loggerFactory)
        {
            Ensure.That(physicsSettings, nameof(physicsSettings)).IsNotNull();

            Gravity       = physicsSettings.DefaultGravity;
            GravityVector = physicsSettings.DefaultGravityVector;

            this.LogDebug("Gravity: Strength = {}, Direction = {}.", Gravity, GravityVector);
        }
Beispiel #4
0
 protected abstract Validation <string, TLocomotion> CreateService(
     KinematicBody target,
     Physics3DSettings physicsSettings,
     ILoggerFactory loggerFactory);