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


C# Animation.GetComponent方法代碼示例

本文整理匯總了C#中Animation.GetComponent方法的典型用法代碼示例。如果您正苦於以下問題:C# Animation.GetComponent方法的具體用法?C# Animation.GetComponent怎麽用?C# Animation.GetComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Animation的用法示例。


在下文中一共展示了Animation.GetComponent方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Play

    /// <summary>
    /// Play the specified animation on the specified object.
    /// </summary>
    public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection,
        EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!NGUITools.GetActive(anim.gameObject))
        {
            // If the object is disabled, don't do anything
            if (enableBeforePlay != EnableCondition.EnableThenPlay) return null;

            // Enable the game object before animating it
            NGUITools.SetActive(anim.gameObject, true);

            // Refresh all panels right away so that there is no one frame delay
            UIPanel[] panels = anim.gameObject.GetComponentsInChildren<UIPanel>();
            for (int i = 0, imax = panels.Length; i < imax; ++i) panels[i].Refresh();
        }

        ActiveAnimation aa = anim.GetComponent<ActiveAnimation>();
        if (aa == null) aa = anim.gameObject.AddComponent<ActiveAnimation>();
        aa.mAnim = anim;
        aa.mDisableDirection = (Direction)(int)disableCondition;
        aa.eventReceiver = null;
        aa.callWhenFinished = null;
        aa.onFinished = null;
        aa.Play(clipName, playDirection);
        return aa;
    }
開發者ID:hyf042,項目名稱:BakeryGirl-chess,代碼行數:29,代碼來源:ActiveAnimation.cs

示例2: Play

    /// <summary>
    /// Play the specified animation on the specified object.
    /// </summary>
    public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection,
        EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        #if UNITY_3_5
        if (!anim.gameObject.active)
        #else
        if (!anim.gameObject.activeSelf)
        #endif
        {
            // If the object is disabled, don't do anything
            if (enableBeforePlay != EnableCondition.EnableThenPlay) return null;

            // Enable the game object before animating it
            NGUITools.SetActive(anim.gameObject, true);
        }

        ActiveAnimation aa = anim.GetComponent<ActiveAnimation>();
        if (aa != null) aa.enabled = true;
        else aa = anim.gameObject.AddComponent<ActiveAnimation>();
        aa.mAnim = anim;
        aa.mDisableDirection = (Direction)(int)disableCondition;
        aa.eventReceiver = null;
        aa.callWhenFinished = null;
        aa.onFinished = null;
        aa.Play(clipName, playDirection);
        return aa;
    }
開發者ID:spyrosgames,項目名稱:PyramidsValley,代碼行數:30,代碼來源:ActiveAnimation.cs

示例3: Play

    /// <summary>
    /// Play the specified animation on the specified object.
    /// </summary>
    public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection,
		EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!anim.gameObject.active)
        {
            // If the object is disabled, don't do anything
            if (enableBeforePlay != EnableCondition.EnableThenPlay) return null;

            // Enable the game object before animating it
            anim.gameObject.SetActiveRecursively(true);
        }

        ActiveAnimation aa = anim.GetComponent<ActiveAnimation>();
        if (aa != null) aa.enabled = true;
        else aa = anim.gameObject.AddComponent<ActiveAnimation>();
        aa.mAnim = anim;
        aa.mDisableDirection = (Direction)(int)disableCondition;
        aa.Play(clipName, playDirection);
        return aa;
    }
開發者ID:xxxred,項目名稱:SoulOfSword,代碼行數:23,代碼來源:ActiveAnimation.cs

示例4: Play

 public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
 {
     if (!anim.gameObject.activeInHierarchy)
     {
         if (enableBeforePlay != EnableCondition.EnableThenPlay)
         {
             return null;
         }
         NGUITools.SetActive(anim.gameObject, true);
     }
     ActiveAnimation component = anim.GetComponent<ActiveAnimation>();
     if (component == null)
     {
         component = anim.gameObject.AddComponent<ActiveAnimation>();
     }
     else
     {
         component.enabled = true;
     }
     component.mAnim = anim;
     component.mDisableDirection = (Direction)disableCondition;
     component.Play(clipName, playDirection);
     return component;
 }
開發者ID:HexHash,項目名稱:LegacyRust,代碼行數:24,代碼來源:ActiveAnimation.cs

示例5: WaitForAnimation

    /// <summary>
    /// Waits for animation.
    /// </summary>
    /// <returns></returns>
    /// <param name="animator">Animator.</param>
    public IEnumerator WaitForAnimation( Animation anim )
    {
        if (anim != null && !anim.isPlaying) {
            Vector3 originalPos = anim.transform.GetChild (0).localPosition;

            anim.Play ("TaskSelected");

            do
            {
                yield return null;
            } while ( anim.isPlaying );

            // Reset UI
            anim.GetComponent<UnityEngine.UI.Image>().color = new Color(1f, 1f, 1f, 0.2352941f);
            anim.transform.GetChild (0).localPosition = originalPos;
        }

        // Reset and close task menu
        taskMenu.gameObject.SetActive(false);
    }
開發者ID:pkurowsk,項目名稱:stratventure,代碼行數:25,代碼來源:UIController.cs

示例6: Play

 public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
 {
     if (!NGUITools.GetActive(anim.gameObject))
     {
         if (enableBeforePlay != EnableCondition.EnableThenPlay)
         {
             return null;
         }
         NGUITools.SetActive(anim.gameObject, true);
         UIPanel[] componentsInChildren = anim.gameObject.GetComponentsInChildren<UIPanel>();
         int i = 0;
         int num = componentsInChildren.Length;
         while (i < num)
         {
             componentsInChildren[i].Refresh();
             i++;
         }
     }
     ActiveAnimation activeAnimation = anim.GetComponent<ActiveAnimation>();
     if (activeAnimation == null)
     {
         activeAnimation = anim.gameObject.AddComponent<ActiveAnimation>();
     }
     activeAnimation.mAnim = anim;
     activeAnimation.mDisableDirection = (Direction)disableCondition;
     activeAnimation.onFinished.Clear();
     activeAnimation.Play(clipName, playDirection);
     if (activeAnimation.mAnim != null)
     {
         activeAnimation.mAnim.Sample();
     }
     else if (activeAnimation.mAnimator != null)
     {
         activeAnimation.mAnimator.Update(0f);
     }
     return activeAnimation;
 }
開發者ID:floatyears,項目名稱:Decrypt,代碼行數:37,代碼來源:ActiveAnimation.cs

示例7: Start

 // Use this for initialization
 void Start()
 {
     introCameraMove = GameObject.FindGameObjectWithTag ("CarCamera").GetComponent<Animation>();
     animationTime = introCameraMove.GetComponent<Animation>().clip.length;
     StartCoroutine ("CountDown");
 }
開發者ID:paleonluna,項目名稱:CT,代碼行數:7,代碼來源:CountDownGUI.cs

示例8: Play

 public static ActiveAnimation Play(Animation anim, string clipName, AnimationOrTween.Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
 {
     if (!NGUITools.GetActive(anim.gameObject))
     {
         if (enableBeforePlay != EnableCondition.EnableThenPlay)
         {
             return null;
         }
         NGUITools.SetActive(anim.gameObject, true);
         UIPanel[] componentsInChildren = anim.gameObject.GetComponentsInChildren<UIPanel>();
         int index = 0;
         int length = componentsInChildren.Length;
         while (index < length)
         {
             componentsInChildren[index].Refresh();
             index++;
         }
     }
     ActiveAnimation component = anim.GetComponent<ActiveAnimation>();
     if (component == null)
     {
         component = anim.gameObject.AddComponent<ActiveAnimation>();
     }
     component.mAnim = anim;
     component.mDisableDirection = (AnimationOrTween.Direction) disableCondition;
     component.onFinished.Clear();
     component.Play(clipName, playDirection);
     return component;
 }
開發者ID:Lessica,項目名稱:Something-of-SHIPWAR-GAMES,代碼行數:29,代碼來源:ActiveAnimation.cs

示例9: Awake

    //---------vv--Functions--vv-------------
    void Awake()
    {
        _UOrigins = new Vector3[UNodes.Length];

        foreach(Transform t in transform.GetComponentsInChildren<Transform>(true))
        {
            if(t.name == localRefName)
                _rulesLocalRef = t;
        }

        int index=0;
        foreach(Transform t in UNodes)
        {
            _UOrigins[index]  = t.localPosition;
            index ++;
        }

        foreach(OrigamiRuleV2 r in displayRules)
        {
            r.ApplyRuleDisplay(Show,transform,_rulesLocalRef);
        }

        _widthVal = _heightVal = 0f;
        _tgtWidth = _tgtHeight = 0f;

        //Récuperation de lanimation
        _anim = GetComponent<Animation>();
        _animState = _anim.GetComponent<Animation>()["Take 001"];
    }
開發者ID:gviaud,項目名稱:OS-unity-5,代碼行數:30,代碼來源:DSModSizes.cs


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