예제 #1
0
    void Update()
    {
        if (inputButtons == null)
        {
            GetInputButtonsRef();
        }
        if (inputAxis.GetPlayerTriggerAxis() > triggerSensitivity)
        {
            if (!canEat)
            {
                return;
            }
            EatSheep();
            canEat = false;
            this.DelayedCall(() => { canEat = true; }, eatCooldown);
        }
        else if (inputButtons.GetPlayerA())
        {
            if (!canDash)
            {
                return;
            }
            Game.Instance.sfx.PlayWolfDashSound();
            dash();
            canDash = false;
            this.DelayedCall(() =>
            {
                canDash = true;
                normalEyes.GetComponent <SpriteRenderer>().DOFade(1, 0.1f).OnComplete(delegate
                {
                    Instantiate(eyeBurst, leftEye.transform.position, Quaternion.identity, leftEye);
                    Instantiate(eyeBurst, rightEye.transform.position, Quaternion.identity, rightEye);
                });
            }, dashCooldown);
        }

        if (IsBumped)
        {
            if (GetComponentInParent <Rigidbody2D>().velocity.magnitude < reactivVelocity)
            {
                ReactivatePlayerMovement();
            }

            reactivationTimer -= Time.deltaTime;
            if (!IsBumped)
            {
                ReactivatePlayerMovement();
            }
        }
    }
예제 #2
0
    /*
     *   public float callingBarkCooldown = 8.0f;
     * private bool canCallingBark = true;
     */

    void Update()
    {
        if (inputButtons == null)
        {
            GetInputButtonsRef();
        }
        if (inputAxis == null)
        {
            GetInputAxisRef();
        }

        if (inputAxis.GetPlayerTriggerAxis() > triggerSensitivity)
        {
            if (!canCallingBark)
            {
                return;
            }

            CallingBark();
            canCallingBark = false;
            this.DelayedCall(() => {
                canCallingBark = true;
                normalEyes.GetComponent <SpriteRenderer>().DOFade(1, 0.1f).OnComplete(delegate
                {
                    Instantiate(eyeBurst, leftEye.transform.position, Quaternion.identity, leftEye);
                    Instantiate(eyeBurst, rightEye.transform.position, Quaternion.identity, rightEye);
                });
            }, callingBarkCooldown);
        }
        if (inputButtons.GetPlayerA())
        {
            if (!canChange)
            {
                return;
            }
            if (currentMode == BergerMode.Repulse)
            {
                Game.Instance.sfx.PlayDogBark();
                SetAttract();
            }
            else
            {
                Game.Instance.sfx.PlayDogGrowl();
                SetRepulse();
            }
        }
    }