當前位置: 首頁>>代碼示例>>C#>>正文


C# Animation.Play方法代碼示例

本文整理匯總了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");
 }
開發者ID:kyle1235,項目名稱:Project_Flat,代碼行數:7,代碼來源:PowerKick.cs

示例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");
 }
開發者ID:martinezpierre,項目名稱:UnityTacticalProject,代碼行數:10,代碼來源:test.cs

示例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();
 }
開發者ID:Exor,項目名稱:SuperMarimoBros,代碼行數:7,代碼來源:Coin.cs

示例5: Start

 // Use this for initialization
 void Start()
 {
     tr = GetComponent<Transform> ();
     _animation = GetComponentInChildren<Animation> ();
     _animation.clip = anim.idle;
     _animation.Play ();
 }
開發者ID:GWseo,項目名稱:GraphicsAssignmnet3_ShootingGame,代碼行數:8,代碼來源:PlayerCtrl.cs

示例6: Start

 // Use this for initialization
 void Start()
 {
     _pigCtrl = GetComponent<pigCtrl> ();
     _animation = GetComponentInChildren<Animation>();
     _animation.clip = anim.walk;
     _animation.Play ();
 }
開發者ID:meetingmeeting,項目名稱:grass_sled_secure,代碼行數:8,代碼來源:pigAni.cs

示例7: OnTriggerEnter

    void OnTriggerEnter(Collider other)
    {
        door = GameObject.FindGameObjectWithTag("SF_Door");

        anim = door.GetComponent<Animation>();
        anim.Play("open");
    }
開發者ID:gilgulim,項目名稱:KillThemAllUnity_Version2,代碼行數:7,代碼來源:Door.cs

示例8: Init

    void Init()
    {
        gunAnim = GetComponent<Animation>();

        gunAnim.clip = idle;
        gunAnim.Play();
    }
開發者ID:JackRFuller,項目名稱:Pillar-Pits,代碼行數:7,代碼來源:PlayerWeaponAnimation.cs

示例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);
 }
開發者ID:ylyking,項目名稱:lynea,代碼行數:11,代碼來源:AnimationSynchronizer.cs

示例10: Start

	void Start () 
    {
        player = GameObject.Find("Player");
        playerState = player.GetComponent<PlayerState>();
        ani = GetComponent<Animation>();
        ani.Play("Idle");
	}
開發者ID:YangJinwoo,項目名稱:FPS,代碼行數:7,代碼來源:Spider.cs

示例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
            });
        }
開發者ID:galaxyyao,項目名稱:TouhouGrave,代碼行數:29,代碼來源:FloatingText.cs

示例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);
		}
	}
開發者ID:ziyihu,項目名稱:TheWolfKillerU3D,代碼行數:34,代碼來源:PlayIdleAnimations.cs

示例13: Start

 // Use this for initialization
 void Start()
 {
     controller = GetComponent<CharacterController>();
     anim = gameObject.GetComponentInChildren<Animation>();
     anim.Play("idle");
     player = this.gameObject;
 }
開發者ID:Kennyomg,項目名稱:fairwinds,代碼行數:8,代碼來源:playerControls.cs

示例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");
 }
開發者ID:Reminouche,項目名稱:iwannaberich,代碼行數:8,代碼來源:MainMenuManager.cs

示例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);
    }
開發者ID:Gh0stBlade,項目名稱:TR2-Level-Viewer,代碼行數:10,代碼來源:DoorStatePlayer.cs


注:本文中的Animation.Play方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。