Example #1
0
    public void SetGraphics(SpriteAnimationHolder animationHolder, bool isShadowAnimated)
    {
        Clear();
        if (rend == null || myShadow == null)
        {
            CreateShadow(height);
        }
        if (anim == null)
        {
            anim = gameObject.AddComponent <AnimatedSpriteController>();
        }

        anim.SetAnimation(animationHolder);
        if (!isShadowAnimated)
        {
            myShadow.GetComponent <SpriteRenderer>().sprite = animationHolder.sprites[0];
        }
        else
        {
            var shadAnim = myShadow.AddComponent <AnimatedSpriteController>();
            shadAnim.SetAnimation(animationHolder);
            shadAnim.syncWith = anim;
        }

        originalPos = transform.localPosition;
    }
Example #2
0
	public void SetAnimation (SpriteAnimationHolder _anim) {
		myRend = GetComponent<SpriteRenderer> ();
		myImg = GetComponent<Image> ();
		myAnim = _anim;
		isSprite = false;

		if (randomIndex) {
			if (myAnim != null) {
				index = Random.Range (0, myAnim.sprites.Length);
			}
		}
		
		Play();

		Update ();
	}