Пример #1
0
 private void InitStats()
 {
     MovementStats nativeMoveStats = new MovementStats();
     ObjectUtil.CopyPasteFields(_stats.Movement, nativeMoveStats);
     _nativeStats = new ShipStats();
     _nativeStats.Movement = nativeMoveStats;
 }
        protected virtual void Awake()
        {
            _thisMovingObject = GetComponent<IMovingObject>();
            _movementStats = _thisMovingObject.MovementStats;

            _rigidBody = GetComponent<Rigidbody>();
            _constantForce = GetComponent<ConstantForce>();

            _movementVector = transform.forward;

            _currentBoostCharges = _movementStats.MaxBoostCharges;
            //_boostParticlesR = transform.Find("BoostParticles_R").GetComponent<ParticleSystem>();
            //_boostParticlesR.gameObject.SetActive(false);
            //_boostParticlesL = transform.Find("BoostParticles_L").GetComponent<ParticleSystem>();
            //_boostParticlesL.gameObject.SetActive(false);
            _cruiserSpeedParticles = transform.FindChild("CruiserSpeedParticles").GetComponent<ParticleSystem>();
            _cruiserSpeedParticles.gameObject.SetActive(false);

            _cruiserSpeedCharger = new Cooldown(_movementStats.SecondsForCruiserSpeed, _thisMovingObject, true);
            _cruiserSpeedCharger.OnReady += (Cooldown cd) => EnableCruiserSpeed();
            _cruiserSpeedCharger.OnStop += (Cooldown cd) => DisableCruiserSpeed();

            _boostChargesWasteFixer = new Cooldown(BoostChargesWasteInterval, _thisMovingObject);
        }