Example #1
0
    protected IEnumerator CoroutineIdle(float time, string animation = "idle")
    {
        interrupt = false;
        animator.PlayAnimation(animation);
        timer = time;
        while (timer > 0)
        {
            timer -= Time.deltaTime;
            yield return(null);

            if (interrupt)
            {
                break;
            }
        }
    }
    void Start()
    {
        Animator2D animator = null;

        if (!animator_on_child)
        {
            animator = gameObject.GetComponent <Animator2D>();
        }
        else
        {
            animator = gameObject.GetComponentInChildren <Animator2D>();
        }

        if (animator != null)
        {
            animator.PlayAnimation(animation_to_play, speed, loop);
        }
    }
Example #3
0
 // Use this for initialization
 void Start()
 {
     _anim = GetComponent<Animator2D>();
     _anim.PlayAnimation("idle");
 }
Example #4
0
 // Use this for initialization
 void Start()
 {
     _anim = GetComponent<Animator2D> ();
     _anim.PlayAnimation ("left");
     _pos = transform.position;
 }
Example #5
0
 // Start is called before the first frame update
 void Start()
 {
     animator.PlayAnimation("Idle", 0.1F);
     rb = GetComponentInParent <Rigidbody2D>();
 }
Example #6
0
 public void OnStartDrawing()
 {
     animator.PlayAnimation("cast");
 }