Beispiel #1
0
    void PlayNext()
    {
        curIdx++;
        GoTween gt = gtList[curIdx];

        if (onUpdate != null)
        {
            curUpdate    = gt._onUpdate;
            gt._onUpdate = OnUpdate;
        }

        curComplete    = gt._onComplete;
        gt._onComplete = OnComplete;
        Go.addTween(gt);
        gt.play();
    }
    IEnumerator Attack(Vector3 pos)
    {
        MonsterVoice.clip = Resources.Load(Sounds.MonsterGrowl) as AudioClip;
        MonsterVoice.Play();

        float dist = Vector3.Distance(transform.localPosition, pos);
        float time = dist / 6f;


        attackTween = Go.to(transform, 3.5f, new GoTweenConfig().localPosition(pos));

        attackTween.play();

        anim.SetBool("SwimmingBool", false);
        anim.SetBool("AttackBool", true);

        yield return(new WaitForSeconds(0.1f));
    }
Beispiel #3
0
    void RunAnimation()
    {
        // Check if we need to clean up the animation
        if (itemAnimation != null)
        {
            // Clean up this item animation from the animation queue
            Go.removeTween(itemAnimation);
            itemAnimation = null;
        }

        // Create and play a new animation
        affectedTransform.transform.parent = transform;
        itemAnimation = Go.to(affectedTransform.transform, animationDuration, itemAnimationConfiguration);
        itemAnimation.setOnCompleteHandler(UpdatePlatform);
        itemAnimation.play();

        // Play audio
        audioScript.Play();
    }
    public void AnimatePositioningItem(Transform parentTo, System.Action <ItemPickup> endAnimationEvent, AudioType playSound = AudioType.None)
    {
        // Setup variables
        onAnimationEnd   = endAnimationEvent;
        transform.parent = parentTo;

        // Setup animation configuration
        itemAnimationConfiguration.clearEvents();
        itemAnimationConfiguration.clearProperties();

        // Setup scale and rotation
        itemAnimationConfiguration.localRotation(Quaternion.identity);
        itemAnimationConfiguration.scale(Vector3.one);

        // Setup path
        itemTweenPath[0] = transform.localPosition;
        itemTweenPath[1] = new Vector3((transform.localPosition.x / 2f), midTweenOffset, 0);
        itemAnimationConfiguration.localPositionPath(new GoSpline(itemTweenPath));

        // Check if we need to clean up the animation
        if (itemAnimation != null)
        {
            // Clean up this item animation from the animation queue
            Go.removeTween(itemAnimation);
            itemAnimation = null;
        }

        // Create and play a new animation
        itemAnimation = Go.to(transform, animationDuration, itemAnimationConfiguration);
        itemAnimation.setOnCompleteHandler(OnAnimationEnds);
        itemAnimation.play();

        // Play a sound effect
        if (playSound == AudioType.Place)
        {
            PlayClip(dropSound);
        }
        else if (playSound == AudioType.PickUp)
        {
            PlayClip(pickupSound);
        }
    }