// Set vars void SetVariables() { if (mode != AnimatorType.None) { animator = GetComponent <Animator>(); // Get list of cached transforms tmList = gameObject.GetComponentsInChildren <Transform>(false).ToList(); tmList.Remove(transform); // No children if (tmList.Count == 0) { Debug.Log("RayFire Record: " + gameObject.name + " Mode set to " + mode.ToString() + " but object has no children. Mode set to None.", gameObject); mode = AnimatorType.None; return; } // Record set SetModeRecord(); // Play set SetModePlay(); } }
private AnimatorDescription(AnimatorController animatorController, AnimatorOverrideController animatorOverrideController, AnimatorType animatorType) { Type = animatorType; _animatorController = animatorController; _animatorOverrideController = animatorOverrideController; }
static string GetAnimatorName(AnimatorType type) { string name = ""; switch (type) { case AnimatorType.Idle: name = "Base.Idle"; break; case AnimatorType.Walk: name = "Base.Walking"; break; case AnimatorType.Run: name = "Base.Running"; break; case AnimatorType.IdleThrow: name = "Base.IdleThrow"; break; case AnimatorType.RunThrow: name = "Base.RunThrow"; break; case AnimatorType.Dead: name = "Base.Death"; break; default: break; } return(name); }
public static void AnimatorPlay(MonoBehaviour mono, Animator animator, AnimatorType type) { switch (type) { case AnimatorType.Attack: if (animator.GetInteger("State") == 0) { mono.StartCoroutine(WorkAfterFrame(() => { if (animator.GetInteger("State") == 1) { animator.SetInteger("State", 0); } }, 2)); } animator.SetInteger("State", 1); break; case AnimatorType.Die: animator.SetInteger("State", 2); break; case AnimatorType.Null: animator.SetInteger("State", 0); break; default: break; } }
void OnThrowAnimatorExit(Animator ani, AnimatorType type, AnimatorStateInfo stateInfo) { if (ani == animator) { if (type == AnimatorType.IdleThrow || type == AnimatorType.RunThrow) { system.PerformTransition(FSMTransition.ThrowToIdle); } } }
public AnimatorCreator(FastBitmap image, BezierPolyline bezierPolyline, int canvasWidth, int canvasHeight) { _animatorType = AnimatorType.Spinning; _rotatorType = RotatorType.Naive; _image = image; //_grayImage = _GetGrayImage(_image); _bezierPolyline = bezierPolyline; _canvasWidth = canvasWidth; _canvasHeight = canvasHeight; }
public static AnimatorType GetTypeByHash(int hash) { AnimatorType animatorType = AnimatorType.Empty; foreach (AnimatorType type in Enum.GetValues(typeof(AnimatorType))) { if (hash == GetHashByType(type)) { animatorType = type; break; } } return(animatorType); }
public static AnimatorType GetCurrentState(Animator animator) { AnimatorType animatorType = AnimatorType.Empty; foreach (AnimatorType type in Enum.GetValues(typeof(AnimatorType))) { if (animator.GetCurrentAnimatorStateInfo(0).fullPathHash == GetHashByType(type)) { animatorType = type; break; } } return(animatorType); }
public override void OnXGUI() { _animatorType = (AnimatorType)CreateEnumSelectable("AnimatorType", _animatorType); switch (_animatorType) { case AnimatorType.AnimatorController: ShowAnimatorController(); break; case AnimatorType.AnimatorModel: ShowAnimatorModel(); break; case AnimatorType.Animator: ShowAnimatorInfo(); break; } }
// Play set void SetModePlay() { if (mode == AnimatorType.Play) { // Check for null controller if (controller == null) { Debug.Log("RayFire Record: " + gameObject.name + " Mode set to " + mode.ToString() + " but controller is not defined. Mode set to None.", gameObject); mode = AnimatorType.None; return; } // Check for null controller if (animationClip == null) { Debug.Log("RayFire Record: " + gameObject.name + " Mode set to " + mode.ToString() + " but animation clip is not defined. Mode set to None.", gameObject); mode = AnimatorType.None; return; } // Check for clip in controller bool hasClip = false; foreach (var anim in controller.animationClips) { if (anim == animationClip) { hasClip = true; } } if (hasClip == false) { Debug.Log("RayFire Record: " + gameObject.name + " Mode set to " + mode.ToString() + " but animation clip is not defined in controller. Mode set to None.", gameObject); mode = AnimatorType.None; return; } // Create animator if (animator == null) { animator = gameObject.AddComponent <Animator>(); } animator.updateMode = AnimatorUpdateMode.AnimatePhysics; // Set defined controller animator.runtimeAnimatorController = controller; } }
public override void OnXGUI() { _animatorType = (AnimatorType)CreateEnumSelectable("AnimatorType", _animatorType); switch (_animatorType) { case AnimatorType.AnimatorController: ShowAnimatorController(); break; case AnimatorType.AnimatorModel: ShowAnimatorModel(); break; case AnimatorType.Animator: ShowAnimatorInfo(); break; } }
void RpcNetSynAnimator(string aniName, int aniType, int isPlay) { AnimatorType aniState = (AnimatorType)aniType; switch (aniState) { case AnimatorType.Trigger: { mAnimator.SetTrigger(aniName); break; } case AnimatorType.Bool: { mAnimator.SetBool(aniName, isPlay == 0 ? false : true); break; } } }
/// <summary> /// 同步网络动画. /// </summary> public void SynNetAnimator(string aniName, AnimatorType aniType, bool isPlay = false) { if (!IsNetControlPort || !enabled) { return; } if (Network.peerType == NetworkPeerType.Client || Network.peerType == NetworkPeerType.Server) { if (NetworkServerNet.GetInstance().mNetworkRootGame.ePlayerGameNetState == NetworkServerNet.PlayerGameNetType.GameBackMovie) { //游戏准备返回循环动画场景,无需继续同步信息! } else { mNetworkView.RPC("RpcNetSynAnimator", RPCMode.Others, aniName, (int)aniType, isPlay == false ? 0 : 1); } } }
public AnimatorDefinition(IAnimationDefinition parent, AnimatorController animator, AnimatorType type) { bool animatorIsNull = animator == null; Parent = parent; Animator = animator; Name = animatorIsNull ? type.ToString() : animator.name; Type = type; if (animatorIsNull) { return; } foreach (AnimatorControllerLayer animatorControllerLayer in animator.layers) { AddLayer(animatorControllerLayer); } foreach (var parameter in animator.parameters) { AddParameter(parameter); } }
public AnimatorDefinition(IAnimationDefinition parent, AnimatorType type, string name = null) { Name = name ?? type.ToString(); Parent = parent; }
public virtual void PlayAnimator(string paramName, AnimatorType type) { myAnimator.SetInteger(paramName, (int)type); }
public static bool GetIsPlaying(Animator animator, AnimatorType type) { return(animator.GetCurrentAnimatorStateInfo(0).fullPathHash == GetHashByType(type)); }
public void Init(UnityEditor.Animations.AnimatorController controller) { animatorType = AnimatorType.Controller; animatorController = controller; Refresh(); }
public static int GetHashByType(AnimatorType type) { return(Animator.StringToHash(GetAnimatorName(type))); }
public void Init(AnimatorOverrideController controller) { animatorType = AnimatorType.Override; animatorOverrideController = controller; Refresh(); }
public TimedAnimator(TimeSpan totalDuration, TOutput startValue, AnimatorType animatorType) { TotalDuration = totalDuration; AnimatorType = animatorType; CurrentValue = StartValue = startValue; }
public DelegateTimedAnimator(Func <double, T> function, TimeSpan totalDuration, T startValue, AnimatorType animatorType) : base(totalDuration, startValue, animatorType) { _function = function; }
public static TimedAnimator <T> ToTimed <T>(this IAnimator <T> animator, TimeSpan totalDuration, T currentValue, AnimatorType animatorType = AnimatorType.Continue) => new DelegateTimedAnimator <T>(animator.Animate, totalDuration, currentValue, animatorType);
public void SetAnimator(AnimatorType animatorType) { _animatorType = animatorType; }