public virtual void Init() { animator = GetComponent <Animator>(); if (animator) { hitDirectionHash = new vAnimatorParameter(animator, "HitDirection"); reactionIDHash = new vAnimatorParameter(animator, "ReactionID"); triggerReactionHash = new vAnimatorParameter(animator, "TriggerReaction"); triggerResetStateHash = new vAnimatorParameter(animator, "ResetState"); recoilIDHash = new vAnimatorParameter(animator, "RecoilID"); triggerRecoilHash = new vAnimatorParameter(animator, "TriggerRecoil"); } var actionListeners = GetComponents <vActions.vActionListener>(); for (int i = 0; i < actionListeners.Length; i++) { if (actionListeners[i].actionEnter) { onActionEnter.AddListener(actionListeners[i].OnActionEnter); } if (actionListeners[i].actionStay) { onActionStay.AddListener(actionListeners[i].OnActionStay); } if (actionListeners[i].actionExit) { onActionExit.AddListener(actionListeners[i].OnActionExit); } } }
protected override void Start() { base.Start(); animator = GetComponent <Animator>(); if (animator) { animatorStateInfos = new vEventSystems.vAnimatorStateInfos(animator); animatorStateInfos.RegisterListener(); hitDirectionHash = new vAnimatorParameter(animator, "HitDirection"); reactionIDHash = new vAnimatorParameter(animator, "ReactionID"); triggerReactionHash = new vAnimatorParameter(animator, "TriggerReaction"); triggerResetStateHash = new vAnimatorParameter(animator, "ResetState"); recoilIDHash = new vAnimatorParameter(animator, "RecoilID"); triggerRecoilHash = new vAnimatorParameter(animator, "TriggerRecoil"); } // slides the character through walls and edges frictionPhysics = new PhysicMaterial(); frictionPhysics.name = "frictionPhysics"; frictionPhysics.staticFriction = .25f; frictionPhysics.dynamicFriction = .25f; frictionPhysics.frictionCombine = PhysicMaterialCombine.Multiply; // prevents the collider from slipping on ramps maxFrictionPhysics = new PhysicMaterial(); maxFrictionPhysics.name = "maxFrictionPhysics"; maxFrictionPhysics.staticFriction = 1f; maxFrictionPhysics.dynamicFriction = 1f; maxFrictionPhysics.frictionCombine = PhysicMaterialCombine.Maximum; // air physics slippyPhysics = new PhysicMaterial(); slippyPhysics.name = "slippyPhysics"; slippyPhysics.staticFriction = 0f; slippyPhysics.dynamicFriction = 0f; slippyPhysics.frictionCombine = PhysicMaterialCombine.Minimum; targetDirection = transform.forward; _rigidbody = GetComponent <Rigidbody>(); _capsuleCollider = GetComponent <CapsuleCollider>(); colliderCenter = _capsuleCollider.center; colliderHeight = _capsuleCollider.height; currentHealth = maxHealth; Collider[] AllColliders = this.GetComponentsInChildren <Collider>(); for (int i = 0; i < AllColliders.Length; i++) { Physics.IgnoreCollision(_capsuleCollider, AllColliders[i]); } IsGroundedAnim = isGrounded = true; _turnOnSpotDirection = transform.forward; targetDirection = transform.forward; if (disableControllerOnStart) { DisableAIController(); } }
protected override void Start() { base.Start(); if (animator) { isBlockingHash = new vAnimatorParameter(animator, "IsBlocking"); isAimingHash = new vAnimatorParameter(animator, "IsAiming"); } strafeCombatSide = 1; }
public virtual void Init() { animator = GetComponent <Animator>(); if (animator) { hitDirectionHash = new vAnimatorParameter(animator, "HitDirection"); reactionIDHash = new vAnimatorParameter(animator, "ReactionID"); triggerReactionHash = new vAnimatorParameter(animator, "TriggerReaction"); triggerResetStateHash = new vAnimatorParameter(animator, "ResetState"); recoilIDHash = new vAnimatorParameter(animator, "RecoilID"); triggerRecoilHash = new vAnimatorParameter(animator, "TriggerRecoil"); } this.LoadActionControllers(debugActionListener); }