本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例7: Start
// Use this for initialization
void Start()
{
introCameraMove = GameObject.FindGameObjectWithTag ("CarCamera").GetComponent<Animation>();
animationTime = introCameraMove.GetComponent<Animation>().clip.length;
StartCoroutine ("CountDown");
}
示例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;
}
示例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"];
}