示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.D))
        {
            statManager.SetValue(Stats.CurrentHP, 0);
        }

        if (isDead)
        {
            return;
        }

        if (PauseManager.isPaused)
        {
            return;
        }

        if (statManager.GetValue(Stats.CurrentHP) <= 0)
        {
            Die();
            return;
        }

        regenCooldown -= Time.deltaTime;
        if (regenCooldown <= 0)
        {
            regenCooldown += 1;
            statManager.ChangeValue(
                Stats.CurrentHP,
                statManager.GetValue(Stats.MaxHP) * (statManager.GetValueF(Stats.HealthRegen) / 100f)
                );
        }

        attackCooldown -= Time.deltaTime * (100f + statManager.GetValue(Stats.AttackSpeed)) / 100f;

        if (attackCooldown <= 0 && combatQueue.NumEnemies() > 0)
        {
            attackCooldown = 1;

            DoAttack();
        }
    }
示例#2
0
    public void ApplyStats(int Adding = 1)
    {
        StatManager sm = GameObject.FindObjectOfType <StatManager>();

        foreach (ItemMod im in itemMods)
        {
            sm.ChangeValue(im.Stat, im.Value * Adding);
        }

        isActive = true;
    }