Ejemplo n.º 1
0
    private void UpdateExplosion()
    {
        if (_ExplosionPhase == eExplosionPhase.fire)
        {
            _xScale += Time.deltaTime * _scaleFactor;
            _yScale += Time.deltaTime * _scaleFactor;

            SetBaseSpriteScale(_xScale, _yScale);

            SetObjectColor(mExplosionRed, mExplosionGreen, mExplosionBlue, _fadeExplosionAlpha);

            _elaspedExplosionTime += Time.deltaTime;
            if (_elaspedExplosionTime >= _explosionTime)
            {
                _elaspedExplosionTime = 0;
                _ExplosionPhase       = eExplosionPhase.fade;
            }
        }
        else if (_ExplosionPhase == eExplosionPhase.fade)
        {
            if (_fadeExplosionAlpha > 0f)
            {
                _fadeExplosionAlpha -= (Time.deltaTime * _fadeFactor);

                if (_fadeExplosionAlpha < 0f)
                {
                    _fadeExplosionAlpha = 0f;

                    _State = eState.Dead;
                }
            }
            SetObjectColor(mExplosionRed, mExplosionGreen, mExplosionBlue, _fadeExplosionAlpha);
        }
    }
Ejemplo n.º 2
0
    private void UpdateFlightPath()
    {
        Vector3 increment = _direction * (Time.deltaTime * _velocity);

        _currentPosition += increment;

        transform.localPosition = _currentPosition;

        Vector3 directionVec = _currentPosition - _firingPosition;
        float   directionMag = directionVec.magnitude;

        if (directionMag > _fightMagnitude)
        {
            _ExplosionPhase       = eExplosionPhase.fire;
            _elaspedExplosionTime = 0f;
            _State = eState.Exploding;
        }
    }
Ejemplo n.º 3
0
    public void Reset()
    {
        transform.localPosition = StoragePosition;

        _fightMagnitude = 0f;

        _xScale      = 0.15f;
        _yScale      = 0.15f;
        _scaleFactor = 3.0f;

        SetBaseSpriteScale(_xScale, _yScale);
        SetObjectColor(255, 255, 255, 255);

        _ExplosionPhase     = eExplosionPhase.ready;
        _fadeExplosionAlpha = 64f;
        _fadeFactor         = 50f;

        mExplosionRed   = 0f;
        mExplosionGreen = 255f;
        mExplosionBlue  = 0f;
    }