Beispiel #1
0
 public void PrepareSkill(PlayerModel pl, Action execute)
 {
     if (pl.currentPointsFRC >= _costPoints)
     {
         pl.currentPointsFRC -= _costPoints;
         execute();
         pl.ChangePointsValue(_thisSkin, pl.currentPointsFRC);
         view.PlayFusRohSound();
     }
 }
    public void PrepareSkill(PlayerModel pl, System.Action execute)
    {
        if (!_isUsingJet)
        {
            view.PlayJetpackSound();
            //PARO RECHARGE
            if (_rechargingJetCoroutine != null)
            {
                pl.StopRecharge(_rechargingJetCoroutine);
            }

            _isUsingJet = true;
            _pl.SetNewStrategies(_jetpackKeys, _jetpackMovement); //Seteo el movimiento y keys del jetpack

            _pl.ControlPhysics();                                 //Parar la fisica de gravedad.
            //Setear al action de eliminar cosas al ser golpeado esto.
            _pl.CancelAttackActionsOnDmg(ReleaseJetpack);

            //LOOSE GAS
            _usingJetCoroutine = pl.RechargeBar(() => { return(pl.currentPointsJetPack > 0); }, () => { pl.currentPointsJetPack -= _stats.decayPointsPerSecond * Time.deltaTime; pl.ChangePointsValue(_thisSkin, Mathf.RoundToInt(pl.currentPointsJetPack)); }, () => { pl.currentPointsJetPack = 0; pl.ChangePointsValue(_thisSkin, 0); ReleaseJetpack(); execute(); });
            _looseJetPoints    = () => pl.StopRecharge(_usingJetCoroutine);

            //RECHARGE
            _startRecharge = () => _rechargingJetCoroutine = pl.RechargeBar(() => { return(pl.currentPointsJetPack < _stats.maxPoints); }, () => { pl.currentPointsJetPack += _stats.rechargePointsPerSecond * Time.deltaTime; pl.ChangePointsValue(_thisSkin, Mathf.RoundToInt(pl.currentPointsJetPack)); }, () => { pl.currentPointsJetPack = _stats.maxPoints; pl.ChangePointsValue(_thisSkin, _stats.maxPoints); });
        }
        else
        {
            //_pl.CancelAttackActionsOnDmg(null);
            ReleaseJetpack();
        }

        execute();
    }