Esempio n. 1
0
    /// <summary>
    /// Init class method.
    /// </summary>
    private void Init()
    {
        // get animator component
        // _animator = GetComponent<Animator>();

        // get camera component from parent.
        _mainCamera = GetComponentInParent <Camera>();

        // get ray shooter component from camera.
        _rayShooter = GetComponentInParent <RayShooter>();

        // get audio component reference.
        _audio = GetComponent <AudioComponent>();

        // calculate heated threshold - this is used to check and update heated weapon status.
        if (plasmaGunData != null)
        {
            float temp = (float)plasmaGunData.heatedRechargeThreeshold / (float)plasmaGunData.maxPlasma;
            _heatedThreshold = temp * 100f;
        }

        // set next level data if not set ( usually when the game is initialised for the first time );
        if (plasmaGunData.nextLevel == null)
        {
            plasmaGunData.nextLevel = plasmaGunData.GetLevelDataObject(plasmaGunData.level + 1);
        }
    }
Esempio n. 2
0
    /// <summary>
    /// Update exp
    /// bar.
    /// </summary>
    /// <param name="displayAnim">bool - display flash animation. True by default</param>
    public void UpdateExpBar(bool displayAnim = true)
    {
        int            nextLevel       = (data.level < 10) ? data.level + 1 : 10;
        PlasmaGunLevel nextLevelData   = data.GetLevelDataObject(nextLevel);
        float          normalizedValue = Utils.instance.Normalize(data.currentExp, 0, nextLevelData.expRequired);

        _bar.fillAmount = normalizedValue;
    }