Пример #1
0
 /// <summary>
 /// Plays the specified SuperSprite animation,
 /// but only if it isn't playing already.
 /// </summary>
 /// <param name="anim">The SuperSprite animation to be played.</param>
 public void DoAnim(SuperSpriteAnim anim)
 {
     if (curAnim != anim | !animating)
     {
         PlayAnim(anim);
     }
 }
Пример #2
0
    /// <summary>
    /// Plays the specified SuperSprite animation.
    /// </summary>
    /// <param name="anim">The SuperSprite animation to be played.</param>
    public void PlayAnim(SuperSpriteAnim anim)
    {
        if (!m_started)
        {
            Start();
        }

        if (curAnim != null)
        {
            curAnim.Hide(true);
        }

        curAnim = anim;
        curAnim.Reset();

        animating = true;
        anim.Play();
    }
Пример #3
0
    // Is called when the animation finishes:
    protected void AnimFinished(SuperSpriteAnim anim)
    {
        animating = false;

        if (animCompleteDelegate != null)
        {
            animCompleteDelegate(this);
        }

        // Handle the OnAnimEnd action:
        if (curAnim != null)
        {
            switch (curAnim.onAnimEnd)
            {
            case SuperSpriteAnim.ANIM_END_ACTION.Play_Default_Anim:
                PlayAnim(defaultAnim);
                break;

            case SuperSpriteAnim.ANIM_END_ACTION.Deactivate:
#if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9
                gameObject.SetActive(false);
#else
                gameObject.SetActiveRecursively(false);
#endif
                break;

            case SuperSpriteAnim.ANIM_END_ACTION.Destroy:
                for (int i = 0; i < animations.Length; ++i)
                {
                    animations[i].Delete();
                }

                Destroy(gameObject);
                break;

            default:
                // Do nothing
                break;
            }
        }
    }
Пример #4
0
	// Is called when the animation finishes:
	protected void AnimFinished(SuperSpriteAnim anim)
	{
		animating = false;

		if (animCompleteDelegate != null)
			animCompleteDelegate(this);

		// Handle the OnAnimEnd action:
		if (curAnim != null)
		{
			switch (curAnim.onAnimEnd)
			{
				case SuperSpriteAnim.ANIM_END_ACTION.Play_Default_Anim:
					PlayAnim(defaultAnim);
					break;
				case SuperSpriteAnim.ANIM_END_ACTION.Deactivate:
					gameObject.SetActiveRecursively(false);
					break;
				case SuperSpriteAnim.ANIM_END_ACTION.Destroy:
					for (int i = 0; i < animations.Length; ++i)
						animations[i].Delete();

					Destroy(gameObject);
					break;
				default:
					// Do nothing
					break;
			}
		}
	}
Пример #5
0
	/// <summary>
	/// Plays the specified SuperSprite animation,
	/// but only if it isn't playing already.
	/// </summary>
	/// <param name="anim">The SuperSprite animation to be played.</param>
	public void DoAnim(SuperSpriteAnim anim)
	{
		if (curAnim != anim | !animating)
			PlayAnim(anim);
	}
Пример #6
0
	/// <summary>
	/// Plays the specified SuperSprite animation.
	/// </summary>
	/// <param name="anim">The SuperSprite animation to be played.</param>
	public void PlayAnim(SuperSpriteAnim anim)
	{
		if (!m_started)
			Start();

		if (curAnim != null)
			curAnim.Hide(true);

		curAnim = anim;
		curAnim.Reset();

		animating = true;
		anim.Play();
	}