public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { base.OnStateExit(animator, stateInfo, layerIndex); var smao = new StateMachineActionObject() { Animator = animator, PathHash = stateInfo.fullPathHash }; foreach (var action in Actions) { action.Execute(smao); } }
public override void OnStateMachineExit(Animator animator, int stateMachinePathHash) { base.OnStateMachineExit(animator, stateMachinePathHash); var smao = new StateMachineActionObject() { Animator = animator, PathHash = stateMachinePathHash }; foreach (var action in Actions) { action.Execute(smao); } }
public override void Execute(StateMachineActionObject smao) { if (IsRandom == true) { State = Random.Range(0, ChildStates); } else { State += 1; if (State > ChildStates) { State = 0; } } smao.Animator.SetInteger(ParameterHash, State); }
public override void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { base.OnStateIK(animator, stateInfo, layerIndex); if (animator.GetLayerWeight(layerIndex) <= 0f && layerIndex > 0 && !IgnoreWeight) { return; } var smao = new StateMachineActionObject() { Animator = animator, PathHash = stateInfo.fullPathHash, StateInfo = stateInfo, LayerIndex = layerIndex, State = AnimatorState.IK }; foreach (var action in Actions) { action.Execute(smao); } }
public override void Execute(StateMachineActionObject smao) { audioBehaviour = smao.Animator.GetComponent <AudioBehaviour>(); if (audioBehaviour != null) { eventName = new NativeString64(audioBehaviour.AudioPrefix + EventName + audioBehaviour.AudioSuffix); } else { eventName = new NativeString64(EventName); } var gao = smao.Animator.GetComponent <GameObjectEntity>(); var target = gao != null ? gao.Entity : Entity.Null; EventSystem.PublishData(new AudioEvent() { EventName = eventName, Options = Options, Target = target }); }
public override void Execute(StateMachineActionObject smao) { for (var i = 0; i < LayerWeights.Count; i++) { var index = i; if (LayerWeights[index] < 0) { continue; } //HACK tweening those to remove jitters //smao.Animator.SetLayerWeight(index, LayerWeights[index]); var target = LayerWeights [index]; DOTween.To ( () => smao.Animator.GetLayerWeight(index), x => smao.Animator.SetLayerWeight(index, x), target, blendTime ).OnComplete(() => smao.Animator.SetLayerWeight(index, target)); } }
public virtual void Execute(StateMachineActionObject smao) { }
public override void Execute(StateMachineActionObject smao) { smao.Animator.SetBool(ParameterHash, Value); }
public override void Execute(StateMachineActionObject smao) { Debug.Log(Message); }
public override void Execute(StateMachineActionObject smao) { Action.Execute(smao); }
public override void Execute(StateMachineActionObject smao) { base.Execute(smao); if (Parameters.Count <= 0) { return; } var keys = ParameterTable.Keys.ToList(); foreach (var key in keys) { ParameterTable[key] = smao.Animator.GetInteger(key); } var scoreGrouping = ParameterTable.GroupBy(kvp => kvp.Value).OrderByDescending(grouping => grouping.Key); var highScores = scoreGrouping.First(); var parameterValue = highScores.Key; var selectedParameter = 0; foreach (var kvp in highScores) { smao.Animator.SetInteger(kvp.Key, 0); if (PreviousParameters.Contains(kvp.Key)) { continue; } else { selectedParameter = kvp.Key; break; } } if (selectedParameter == 0) { PreviousParameters.Clear(); selectedParameter = highScores.First().Key; } PreviousParameters.Add(selectedParameter); if (WaitForExit != null) { WaitForExit.Dispose(); } WaitForExit = Observable.EveryUpdate().Where(_ => smao.Animator.State(smao.LayerIndex) == smao.PathHash).FirstOrDefault() .SelectMany(Observable.EveryUpdate().Where(_ => smao.Animator.State(smao.LayerIndex) != smao.PathHash)).FirstOrDefault() .Subscribe(_ => { foreach (var kvp in highScores) { //only reset if the value is still zero var currentParameterValue = smao.Animator.GetInteger(kvp.Key); if (currentParameterValue == 0 || currentParameterValue == parameterValue + 1) { smao.Animator.SetInteger(kvp.Key, parameterValue); } } }).AddTo(smao.Animator); smao.Animator.SetInteger(selectedParameter, parameterValue + 1); }
public override void Execute(StateMachineActionObject smao) { base.Execute(smao); ScriptableAction.Execute(smao); }
public override void Execute(StateMachineActionObject smao) { var value = Random.Range(RangedValue.MinValue, RangedValue.MaxValue); smao.Animator.SetInteger(ParameterHash, value); }
public override void Execute(StateMachineActionObject smao) { Debug.Break(); }