本文整理汇总了C#中UnityEngine.Animator.GetCurrentAnimatorStateInfo方法的典型用法代码示例。如果您正苦于以下问题:C# Animator.GetCurrentAnimatorStateInfo方法的具体用法?C# Animator.GetCurrentAnimatorStateInfo怎么用?C# Animator.GetCurrentAnimatorStateInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Animator
的用法示例。
在下文中一共展示了Animator.GetCurrentAnimatorStateInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WaitForAnimation
private IEnumerator WaitForAnimation(Animator animator)
{
do
{
yield return null;
} while (animator.GetCurrentAnimatorStateInfo(0).IsName("Armature|Victory") || animator.GetCurrentAnimatorStateInfo(0).IsName("Armature|Victory0") || animator.IsInTransition(0));
laser.SetActive(true);
}
示例2: CacheAnimState
/// <summary>
/// cache animator states and their data
/// </summary>
public static void CacheAnimState(Animator anim, out int[] animStateNames, out float[] animStateTimes)
{
animStateNames = new int[anim.layerCount];
animStateTimes = new float[anim.layerCount];
for (int i = 0; i < anim.layerCount; i++)
{
animStateNames[i] = anim.GetCurrentAnimatorStateInfo(i).fullPathHash;
animStateTimes[i] = anim.GetCurrentAnimatorStateInfo(i).normalizedTime;
}
}
示例3: CheckIsInState
/// <summary>
// Checks if the animator is in a specified state on any of its layers, and
// returns the state info.
/// </summary>
/// <returns><c>true</c>, if in the state, <c>false</c> otherwise.</returns>
/// <param name="animator">Animator.</param>
/// <param name="stateName">State name.</param>
/// <param name="animatorStateInfo">(Out) Animator state info.</param>
private bool CheckIsInState(Animator animator, string stateName, out AnimatorStateInfo animatorStateInfo)
{
if (animator != null) {
for (int layerIndex = 0; layerIndex < animator.layerCount; layerIndex++) {
AnimatorStateInfo info = animator.GetCurrentAnimatorStateInfo(layerIndex);
if (info.IsName(stateName)) {
animatorStateInfo = info;
return true;
}
}
}
animatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
return false;
}
示例4: Start
// Use this for initialization
void Start()
{
material = GetComponentInChildren<Renderer>().materials[qualMaterial];
animator = GetComponent<Animator>();
if(animator)
animaState = animator.GetCurrentAnimatorStateInfo(0);
}
示例5: Update
// Update is called once per frame
void Update()
{
tempo+=Time.deltaTime;
if(animator)
{
animaState = animator.GetCurrentAnimatorStateInfo(0);
if(animaState.IsName("padrao")){
if(tempo>TEMPO_DE_PISCAR )
{
piscarAgora();
}
}else if(animaState.IsName("cair")){
material.mainTextureOffset = new Vector3(3*deslocamento,0);
}else if(animaState.IsName("dano1")){
tempo = TEMPO_DE_PISCAR;
piscarAgora();
}else
material.mainTextureOffset = new Vector3(0,0);
}else
{
animator = GetComponent<Animator>();
if(animator)
animaState = animator.GetCurrentAnimatorStateInfo(0);
}
}
示例6: WallJump
public void WallJump(Animator myAnimator, Rigidbody2D myRigidbody2D, WallCheck[] allWallChecks)
{
if(!lockWallJump)
{
foreach(WallCheck localWallCheck in allWallChecks)
{
if(localWallCheck.walled)
{
lockWallJump = true;
if(myRigidbody2D.transform.localScale.x < 0)
{
myRigidbody2D.AddForce(new Vector2(myRigidbody2D.velocity.x + jumpForce.x, jumpForce.y));
}
else
{
myRigidbody2D.AddForce(new Vector2(myRigidbody2D.velocity.x - jumpForce.x, jumpForce.y));
}
if(!myAnimator.GetCurrentAnimatorStateInfo(0).IsName(jumpAnimationName))
{
myAnimator.SetTrigger(jumpAnimationTriggerName);
}
Invoke ("UnlockWallJump", lockTime);
break;
}
}
}
}
示例7: Start
//private float _seed = 0.0f;
// Use this for initialization
void Start()
{
anim = GetComponent<Animator> ();
currentState = anim.GetCurrentAnimatorStateInfo (0);
previousState = currentState;
StartCoroutine ("RandomChange");
}
示例8: Start
// Use this for initialization
void Start()
{
// 各参照の初期化
anim = GetComponent<Animator> ();
currentState = anim.GetCurrentAnimatorStateInfo (0);
previousState = currentState;
}
示例9: AnimatorHelper
public AnimatorHelper (Animator a)
{
animator = a;
currentState_ = animator.GetCurrentAnimatorStateInfo (0);
RefreshSubAnimators ();
}
示例10: Awake
private void Awake()
{
action = playerAction.normal;
anim = GetComponent<Animator>();
attackColl = GameObject.Find(PathHelper.playerAttackColliderPath).GetComponent<SphereCollider>();
stateInfo = anim.GetCurrentAnimatorStateInfo(0);
characterController = GetComponent<CharacterController>();
}
示例11: IsDone
public static bool IsDone(Animator anim, int loopCount = 1)
{
if (anim)
{
return anim.GetCurrentAnimatorStateInfo(Default_Layer).normalizedTime >= (float)loopCount;
}
return true;
}
示例12: IsStateActive
/// <summary>
/// Returns true when the current state is active.
/// </summary>
/// <param name="name">name of state</param>
/// <param name="animator">animator object</param>
/// <returns></returns>
public static bool IsStateActive(string name, Animator animator)
{
for (int i = 0; i < animator.layerCount; i++)
{
if (animator.GetCurrentAnimatorStateInfo(i).IsName(name)) return true;
}
return false;
}
示例13: IsName
public static bool IsName(Animator anim,string name)
{
if (anim)
{
return anim.GetCurrentAnimatorStateInfo(Default_Layer).IsName(name);
}
return false;
}
示例14: OnStateExit
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if(animator.GetCurrentAnimatorStateInfo(0).fullPathHash == AnimationIDs.IDLE_STATE)
{
PlayerMovement playerMovement = animator.gameObject.GetComponent<PlayerMovement>();
playerMovement.MoveLocked = false;
playerMovement.ForceAim = false;
}
}
示例15: Start
// Use this for initialization
void Start ()
{
// 各参照の初期化
anim = GetComponent<Animator> ();
currentState = anim.GetCurrentAnimatorStateInfo (0);
previousState = currentState;
// ランダム判定用関数をスタートする
StartCoroutine ("RandomChange");
}