本文整理匯總了C#中Animation.Play方法的典型用法代碼示例。如果您正苦於以下問題:C# Animation.Play方法的具體用法?C# Animation.Play怎麽用?C# Animation.Play使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Animation
的用法示例。
在下文中一共展示了Animation.Play方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Attack
public override void Attack(Animation animation, float directionX)
{
if (directionX == 1)
animation.Play("powerKickLeft");
else
animation.Play("powerKickRight");
}
示例2: Start
// Use this for initialization
void Start()
{
animation = gameObject.GetComponent<Animation>();
animation.Play("Dead");
animation.Play("Damage");
animation.Play("Walk");
animation.Play("Wait");
animation.Play("Attack");
}
示例3: Start
void Start()
{
animation = GetComponent<Animation>();
states = new List<AnimationState>(animation.Cast<AnimationState>());
if (PlayerPrefs.GetInt("firstSeed") == 1)
animation.Play(states[0].name);
if (PlayerPrefs.GetInt("secondSeed") == 1)
animation.Play(states[1].name);
}
開發者ID:cristi16,項目名稱:Artefacts---Collaborative-evolution-of-three-dimensional-objects,代碼行數:11,代碼來源:ShowSideUI.cs
示例4: Coin
public Coin(Vector2 initialPosition)
: base(initialPosition)
{
coin = new Animation(Textures.GetTexture(Textures.Texture.coin), new Rectangle(0, 0, 16, 16), 3, 0.2f, 0);
coin.IsLooping = true;
coin.Play();
}
示例5: Start
// Use this for initialization
void Start()
{
tr = GetComponent<Transform> ();
_animation = GetComponentInChildren<Animation> ();
_animation.clip = anim.idle;
_animation.Play ();
}
示例6: Start
// Use this for initialization
void Start()
{
_pigCtrl = GetComponent<pigCtrl> ();
_animation = GetComponentInChildren<Animation>();
_animation.clip = anim.walk;
_animation.Play ();
}
示例7: OnTriggerEnter
void OnTriggerEnter(Collider other)
{
door = GameObject.FindGameObjectWithTag("SF_Door");
anim = door.GetComponent<Animation>();
anim.Play("open");
}
示例8: Init
void Init()
{
gunAnim = GetComponent<Animation>();
gunAnim.clip = idle;
gunAnim.Play();
}
示例9: InitAnimation
/*
* this function is called by CharacterGenerator after having loaded the character, which can be done asynchroneouosly (Unity Pro).
* As a result, ChangeAnimationState MAY have been called before InitAnimation, which would result in Playing an animation other than the default "idle1"
*/
public void InitAnimation()
{
anim = GetComponentInChildren(typeof(Animation)) as Animation;
anim.wrapMode = WrapMode.Loop;
anim.Play(lastState);
//Debug.Log("InitAnimation > "+lastState);
}
示例10: Start
void Start ()
{
player = GameObject.Find("Player");
playerState = player.GetComponent<PlayerState>();
ani = GetComponent<Animation>();
ani.Play("Idle");
}
示例11: Register
public void Register(TextRenderer.IFormattedText text, TextRenderer.DrawOptions drawOptions,
Vector2 screenPosStart, Vector2 screenPosEnd,
Animation.Track positionTrack, Animation.Track alphaTrack)
{
if (text == null)
{
throw new ArgumentNullException("text");
}
else if (positionTrack == null)
{
throw new ArgumentNullException("positionTrack");
}
positionTrack.Play();
if (alphaTrack != null)
{
alphaTrack.Play();
}
m_entries.Add(new Entry
{
m_text = text,
m_drawOptions = drawOptions,
m_2dPosStart = screenPosStart,
m_2dPosEnd = screenPosEnd,
m_positionTrack = positionTrack,
m_alphaTrack = alphaTrack
});
}
示例12: Start
/// <summary>
/// Find all idle animations.
/// </summary>
void Start ()
{
mAnim = GetComponentInChildren<Animation>();
if (mAnim == null)
{
Debug.LogWarning(NGUITools.GetHierarchy(gameObject) + " has no Animation component");
Destroy(this);
}
else
{
foreach (AnimationState state in mAnim)
{
if (state.clip.name == "idle")
{
state.layer = 0;
mIdle = state.clip;
mAnim.Play(mIdle.name);
}
else if (state.clip.name.StartsWith("idle"))
{
state.layer = 1;
mBreaks.Add(state.clip);
}
}
// No idle breaks found -- this script is unnecessary
if (mBreaks.Count == 0) Destroy(this);
}
}
示例13: Start
// Use this for initialization
void Start()
{
controller = GetComponent<CharacterController>();
anim = gameObject.GetComponentInChildren<Animation>();
anim.Play("idle");
player = this.gameObject;
}
示例14: ContractMenu
public void ContractMenu(Animation animScript)
{
var audioClip = Resources.Load<AudioClip>("Audios/click_open");
var audioClickClip = Resources.Load<AudioClip>("Audios/click");
AudioSource.PlayClipAtPoint(audioClickClip, transform.position, 1);
AudioSource.PlayClipAtPoint(audioClip, transform.position, 1);
animScript.Play("TitlePanelContract");
}
示例15: Start
// Use this for initialization
void Start()
{
m_Animation = GetComponent<Animation>();
On = m_Animation.GetClipCount() - 1;
m_CurrentKeyState = Off;
m_Animation.wrapMode = WrapMode.ClampForever;
m_Animation.Play(""+ m_CurrentKeyState);
}