Example #1
0
    void HitSheep()
    {
        if (!isDead)
        {
            audio.Play();
            anim.Play("dead");
            LeanTween.cancel(gameObject);

            float ypos = transform.position.y;
            LeanTween.moveY(gameObject, ypos + 6.0f, 1.5f).setEase(LeanTweenType.easeOutCubic);
            LeanTween.moveY(gameObject, ypos, 1.5f).setEase(LeanTweenType.easeInCubic).setDelay(1.5f);
            LeanTween.moveZ(gameObject, 18f, 3.0f).setEase(LeanTweenType.easeOutCubic).setOnComplete(Complete);

            Vector3 pos = Camera.main.WorldToScreenPoint(transform.position);
            pos.z = 3.5f;
            Emanager.SendMessage("CreateExplosion", UICam.ScreenToWorldPoint(pos));
            isDead = true;
        }
    }