Example #1
0
 public override void Simulate()
 {
     _rollbackTimer.Simulate();
     if (_rollbackTimer.ShouldExecute())
     {
         gameObject.SetActive(false);
     }
 }
Example #2
0
    public override void Simulate()
    {
        _asteroidSpawnRate.Simulate();

        if (_asteroidSpawnRate.ShouldExecute())
        {
            CreateAsteroid();
            _asteroidSpawnRate.Reset();
        }
    }
Example #3
0
        public override void Simulate()
        {
            if (_playerId == -1)
            {
                return;
            }

            Vector2 newDirection;

            newDirection.x = RollbackManager.rbInputManager.GetAxis(RollbackInputManager.AxisEnum.HORIZONTAL, _playerId);
            newDirection.y = RollbackManager.rbInputManager.GetAxis(RollbackInputManager.AxisEnum.VERTICAL, _playerId);
            _playerMovement.SetDirection(newDirection);

            _rollbackTimerBetweenShoots.Simulate();
            if (_rollbackTimerBetweenShoots.ShouldExecute())
            {
                if (RollbackManager.rbInputManager.GetInputDown((int)CustomInputManager.ActionsCode.SHOOT, _playerId))
                {
                    ProjectileManager.Instance.poolManager.CreateObject(_shootPosition.position, _playerMovement.spriteTransform.rotation, _projectileSpeed);
                    _rollbackTimerBetweenShoots.Reset();
                }
            }
        }