Esempio n. 1
0
    protected override void OnUpdate(float dT)
    {
        updateSlotInput();
        mana.OnUpdate(dT);
        Gun     selectedGun = guns[selectedGunIndex];
        bool    shouldShoot = Target != null;
        Vector3 targetPos   = Target != null ? Target.position : Vector3.zero;

        if (Input.GetButton("Fire"))
        {
            shouldShoot = true;
            targetPos   = MouseManager.Instance.WorldPos;
        }
        selectedGun.OnUpdate(dT, shouldShoot, targetPos, transform.position, mana);
        updateReticle();
    }
Esempio n. 2
0
    protected override void OnUpdate(float dT)
    {
        if (health.Current <= 0)
        {
            Remove();
            return;
        }

        health.OnUpdate(dT);

        if (damageTimer > 0.0f)
        {
            damageTimer -= dT;
            flashTimer  -= dT;
            if (damageTimer <= 0.0f)
            {
                stopFlashing();
            }
            else if (flashTimer <= 0.0f)
            {
                toggleFlash();
            }
        }
    }