Advertisement
Selzier

Crouch.cs Motion Builder Documentation

Apr 18th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.23 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. namespace com.ootii.Actors.AnimationControllers {
  6.     public class Crouch : MotionControllerMotion {
  7.  
  8.         public const int PHASE_UNKNOWN = 0;
  9.         public const int PHASE_START_IDLE = 4001;
  10.         public const int PHASE_START_MOVING = 4002;
  11.  
  12.         public Crouch() : base() {
  13.             _Priority = 1;
  14.             _ActionAlias = "Fire3";
  15.             _ReactivationDelay = 0.1f;
  16.  
  17. #if UNITY_EDITOR
  18.             if (_EditorAnimatorSMName.Length == 0) { _EditorAnimatorSMName = "Crouch-SM"; }
  19. #endif
  20.         }
  21.  
  22.         public Crouch(MotionController rController) : base(rController) {
  23.             _Priority = 1;
  24.             _ActionAlias = "Fire3";
  25.             _ReactivationDelay = 0.1f;
  26.  
  27. #if UNITY_EDITOR
  28.             if (_EditorAnimatorSMName.Length == 0) { _EditorAnimatorSMName = "Crouch-SM"; }
  29. #endif
  30.         }
  31.  
  32.         public override bool TestActivate() {
  33.             if (!mIsStartable) { return false; }
  34.             if (!mMotionController.IsGrounded) { return false; }
  35.             if (mMotionController._InputSource.IsJustPressed(_ActionAlias)) { return true; }
  36.             return false;
  37.         }
  38.  
  39.         public override bool TestUpdate() {
  40.             if (mIsActivatedFrame) { return true; }
  41.             if (mIsAnimatorActive) {
  42.                 if (!mMotionController.IsGrounded) { return false; }
  43.                 if (mMotionController._InputSource.IsJustPressed(_ActionAlias)) { return false; }
  44.             }
  45.             return true;
  46.         }
  47.  
  48.         public override bool Activate(MotionControllerMotion rPrevMotion) {
  49.             mMotionController.SetAnimatorMotionPhase(mMotionLayer._AnimatorLayerIndex, Crouch.PHASE_START_IDLE, true);
  50.             return base.Activate(rPrevMotion);
  51.         }
  52.  
  53.         public override void UpdateRootMotion(float rDeltaTime, int rUpdateIndex, ref Vector3 rMovement, ref Quaternion rRotation) {
  54.             rRotation = Quaternion.identity;
  55.             //base.UpdateRootMotion(rDeltaTime, rUpdateIndex, ref rMovement, ref rRotation);
  56.         }
  57.  
  58.         public override void Update(float rDeltaTime, int rUpdateIndex) {
  59.             //base.Update(rDeltaTime, rUpdateIndex);
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement