NextAnimPlay class


캐릭터의 애니메이션 인스펙터의 애니메이션 클립 리스트를 리스트에 무조건 담아서 플레이.스페이스바를 누를 때 마다 다음 애니메이션이 재생.


using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class NextAnimPlay : MonoBehaviour {

	
	private List _animationList = new List();
	private int _curID = 0;
	
	void Start () 
	{
		
		
		foreach( AnimationState state in animation)
		{
			_animationList.Add(state.name);
		
			
			Debug.Log(_animationList.Count);
		}
		
		animation.Play(_animationList[0]);
		
		
		
	}
	

	void Update () 
	{
		if(Input.GetKeyDown(KeyCode.Space))
		{
			NextPlayCall();	
		}
	}
	
	private void NextPlayCall()
	{
		_curID += 1;	
		_curID %= _animationList.Count;
		
		animation.Play(_animationList[_curID]);
	}
	
	
}

Game Developer Leegoon copyright all right reserved since 2010.

Comments