Esempio n. 1
0
    public override void UpdateValues()
    {
        anim.SetBool(moveBoolName, ic.move.magnitude > 0.0f || pmc.IsOnGround() == false);

        if (ic.move.x > 0)
        {
            rend.flipX = false;
        }

        if (ic.move.x < 0)
        {
            rend.flipX = true;
        }

        if (ac.isAttacking)
        {
            if (attackTrigger != true)
            {
                anim.SetTrigger(attackTriggerName);
                attackTrigger = true;
            }
        }
        else
        {
            attackTrigger = false;
        }
    }
    public override void Update()
    {
        if (input.action)
        {
            if (isAttacking == false && !overheated & !buttonPressed)
            {
                if (pmc.IsOnGround() == false && pmc.onGround == false)
                {
                    isAttacking = true;
                    OnAttack();
                }
            }

            buttonPressed = true;
        }
        else
        {
            buttonPressed = false;

            if (isAttacking)
            {
                isAttacking = false;
            }
        }


        if (!overheated)
        {
            if (heat >= warningThresholdOn && !warning)
            {
                warning = true;
                onWarningStart.Invoke();
            }

            if (heat <= warningThresholdOff && warning)
            {
                warning = false;
                onWarningEnd.Invoke();
            }

            if (heat >= overheatThreshhold)
            {
                overheated = true;
                onOverheatStart.Invoke();

                warning = false;
                onWarningEnd.Invoke();
            }
        }

        if (heat > 0)
        {
            if (!overheated)
            {
                heat -= normalCooldown * Time.deltaTime;
            }
            else
            {
                heat -= overheatCooldown * Time.deltaTime;

                if (heat <= 0 && overheated == true)
                {
                    overheated = false;
                    heat       = 0;
                    onOverheatEnd.Invoke();
                }
            }
        }

        slider.value = heat;
    }