Beispiel #1
0
 // If inflated, begin the countdown. When it reaches zero, set inflated to false and return the object to it's
 // normal size. Turn off the power of the battery script to ensure it will glow when the mouse it over it again.
 private void LateUpdate()
 {
     anim.SetBool("puffed", inflated);
     if (inflated)
     {
         if (easeTimer < 1)
         {
             easeTimer           += 2 * Time.deltaTime;
             easeTimer            = Mathf.Min(easeTimer, 1);
             transform.localScale = Vector3.one * EasingFunction.EaseOutElastic(initialSize, inflatedSize, easeTimer);
         }
         timer -= Time.deltaTime;
         if (timer <= 0)
         {
             inflated = false;
             anim.SetBool("puffed", false);
             bat.PowerOff();
         }
     }
     else if (easeTimer > 0)
     {
         easeTimer           -= Time.deltaTime;
         easeTimer            = Mathf.Max(easeTimer, 0);
         transform.localScale = Vector3.one * EasingFunction.EaseInElastic(initialSize, inflatedSize, easeTimer);
     }
     if (bat.GetActive())
     {
         Inflate();
         bat.PowerOff();
     }
 }
Beispiel #2
0
 private void Update()
 {
     if (wobbleLerp > 0)
     {
         wobbleLerp = wobbleLerp - 0.5f * Time.deltaTime;
         sprite.transform.localScale = Vector3.one * EasingFunction.EaseInElastic(1, 12, wobbleLerp);
     }
     else
     {
         sprite.transform.localScale = Vector3.one;
     }
 }
Beispiel #3
0
    // Update is called once per frame
    void Update()
    {
        if (!Input.GetButton("Fire1"))
        {
            isHeld = false;
        }
        if (!isHeld)
        {
            mouse.transform.eulerAngles = Vector3.zero;
            if (!ParentIsInsideBone())
            {
                transform.parent = null;
            }
            collider.isTrigger = true;
        }

        if (!isHeld && collider.isTrigger)
        {
            collider.isTrigger = false;
        }


        if (isHeld)
        {
            rb.bodyType                 = RigidbodyType2D.Kinematic;
            transform.localScale        = scaleNormal * 1.25f;
            mouse.transform.eulerAngles = new Vector3(0, 0, EasingFunction.EaseInElastic(mouse.transform.eulerAngles.z, 90.01f, 0.39f));
        }
        else if (rb.bodyType != RigidbodyType2D.Dynamic && !ParentIsInsideBone())
        {
            rb.bodyType          = RigidbodyType2D.Dynamic;
            transform.localScale = scaleNormal;

            //oh gee howdy do I love throwin' bones with some M A G I C N U M B E R S
            rb.AddForce((mouse.transform.position - previousMousePosition) * 50.0f, ForceMode2D.Impulse);
        }

        previousMousePosition = mouse.transform.position;

        if (ParentIsInsideBone())
        {
            collider.isTrigger = true;
        }
    }
        private IEnumerator CloseTransition()
        {
            float t = 0;

            while (true)
            {
                bubbleFrame.transform.localScale = _initialScale * EasingFunction.EaseInElastic(1, 0, t);
                _group.alpha = EasingFunction.EaseInElastic(1, 0, t);
                t           += Time.deltaTime * _transitionSpeed;

                if (t > 1.1f)
                {
                    break;
                }

                yield return(null);
            }

            _opened       = false;
            _inTransition = false;
            bubbleFrame.gameObject.SetActive(false);
        }