本文整理汇总了C#中Animation类的典型用法代码示例。如果您正苦于以下问题:C# Animation类的具体用法?C# Animation怎么用?C# Animation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Animation类属于命名空间,在下文中一共展示了Animation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnButton3Clicked
void OnButton3Clicked(object sender, EventArgs args)
{
Button button = (Button)sender;
// Create parent animation object.
Animation parentAnimation = new Animation();
// Create "up" animation and add to parent.
Animation upAnimation = new Animation(
v => button.Scale = v,
1, 5, Easing.SpringIn,
() => Debug.WriteLine("up finished"));
parentAnimation.Add(0, 0.5, upAnimation);
// Create "down" animation and add to parent.
Animation downAnimation = new Animation(
v => button.Scale = v,
5, 1, Easing.SpringOut,
() => Debug.WriteLine("down finished"));
parentAnimation.Insert(0.5, 1, downAnimation);
// Commit parent animation
parentAnimation.Commit(
this, "Animation3", 16, 5000, null,
(v, c) => Debug.WriteLine("parent finished: {0} {1}", v, c));
}
示例2: Start
//public GameObject _player;
//public float _distance;
// Use this for initialization
void Start()
{
_animation = GetComponent<Animation> ();
string _animationToPlay = _animationClip.name.ToString();
//int animCount = _animation.GetClipCount(); // clip?! Unity people, why not state??
//Debug.Log("Animations found: " + animCount );
//_player = GameObject.FindGameObjectWithTag("Player");
_animation[_animationToPlay].wrapMode = WrapMode.Loop;
_animation.PlayQueued(_animationToPlay, QueueMode.CompleteOthers);
// foreach(AnimationState s in _animation) {
//
// string theName = s.name.ToString();
// //_animation[theName].wrapMode = WrapMode.Once;
// _animation.PlayQueued(theName, QueueMode.CompleteOthers);
//
//
//
// }
//
}
示例3: 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);
}
}
示例4: coroutineAnimation
public void coroutineAnimation(Animation a, CompleteDelegate completeDeletgate)
{
object[] parameters = new object[2]{a, completeDeletgate};
StatusManager.enableNextOrder = false;
StartCoroutine("animationWait",parameters);
}
示例5: Start
// Use this for initialization
void Start()
{
anim = gameObject.GetComponent<Animation> ();
sc = gameObject.GetComponent<SphereCollider> ();
bc = gameObject.GetComponent<BoxCollider> ();
initSound ();
}
示例6: setAnimationTypeAndValue
/// <summary>
/// Will set the Animation with the supplied parameter
/// </summary>
/// <param name="animation">The Animation to set</param>
/// <param name="animator">The animator to get the Animations</param>
/// <param name="parameter">The value for the Animation</param>
public static void setAnimationTypeAndValue(Animation animation, Animator animator, object value)
{
if(value == null) {
return;
}
//Grab what Type of parameter
AnimatorControllerParameter param = getAnimatorControllerParameter(animation, animator);
//If param doesn't exist, just get out
if(param == null) {
return;
}
switch(param.type) {
case AnimatorControllerParameterType.Bool:
animator.SetBool(animation.ToString(), (bool)value);
break;
case AnimatorControllerParameterType.Float:
animator.SetFloat(animation.ToString(), (float)value);
break;
case AnimatorControllerParameterType.Int:
animator.SetInteger(animation.ToString(), (int)value);
break;
case AnimatorControllerParameterType.Trigger:
animator.SetTrigger(animation.ToString());
break;
default:
break;
}
}
示例7: Start
// Use this for initialization
void Start()
{
anim = this.GetComponent<Animation> ();
// this.transform.position = Vector3.zero; // make sure the paddle is centered to the base
// this.transform.position += new Vector3 (0, startingYOffset, 0);// this will adjust the position to to below the base when the
}
示例8: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
Animation animation = new Animation();
animation.Type = DropDownList1.SelectedValue;
try
{
animation.Cascade = double.Parse(TextBox1.Text);
}
catch (Exception)
{
TextBox1.Text = "1";
animation.Cascade = 1;
}
try
{
animation.Delay = double.Parse(TextBox2.Text);
}
catch (Exception)
{
TextBox2.Text = "0.5";
animation.Delay = 0.5;
}
line1.OnShowAnimation = animation;
OpenFlashChartControl1.Chart = chart;
}
示例9: Start
void Start()
{
animation = GetComponent<Animation>();
_source = GetComponent<AudioSource>();
_madeNoise = false;
}
示例10: Start
void Start () {
anim = GetComponent<Animation> ();
death = false;
enemies = 12;
}
示例11: Start
void Start ()
{
player = GameObject.Find("Player");
playerState = player.GetComponent<PlayerState>();
ani = GetComponent<Animation>();
ani.Play("Idle");
}
示例12: Start
public void Start () {
anim = GetComponent<Animation>();
animState = anim[anim.clip.name];
// reset effects
percent = 0;
Sample();
}
示例13: Start
// Use this for initialization
void Start()
{
// set animation
this.animation = GetComponent<Animation> ();
// set fire ligth
this.fireLigth = this.effects.GetComponent<Light> ();
}
示例14: Start
// Use this for initialization
void Start()
{
m_Animation = GetComponent<Animation>();
m_CurrentKeyState = Idle;
m_StartPos = transform.position;
m_TargetPos = m_StartPos;
}
示例15: Setup
// If target or rigidbody are not set, try using fallbacks
void Setup()
{
if (target == null)
{
target = GetComponent<Animation> ();
}
}