Ejemplo n.º 1
0
 public GlobeLoopUpdater(
     IGlobeLoopContext gameLoopContext,
     IAnimationBlockerService animationBlockerService)
 {
     _gameLoopContext         = gameLoopContext;
     _animationBlockerService = animationBlockerService;
 }
Ejemplo n.º 2
0
 public SectorUiState(ICommandPool commandPool, IAnimationBlockerService animationBlockerService,
                      ICommandLoopUpdater commandLoopUpdater)
 {
     _commandPool             = commandPool;
     _animationBlockerService = animationBlockerService;
     _commandLoopUpdater      = commandLoopUpdater;
 }
Ejemplo n.º 3
0
 public CommandLoopContext(IPlayer player, IHumanActorTaskSource <ISectorTaskSourceContext> humanActorTaskSource,
                           IAnimationBlockerService animationBlockerService)
 {
     _player = player ?? throw new ArgumentNullException(nameof(player));
     _humanActorTaskSource =
         humanActorTaskSource ?? throw new ArgumentNullException(nameof(humanActorTaskSource));
     _animationBlockerService = animationBlockerService;
 }
Ejemplo n.º 4
0
 public GameLoopUpdater(
     IPlayer player,
     IAnimationBlockerService commandBlockerService,
     IInventoryState inventoryState,
     ISectorUiState playerState)
 {
     _commandBlockerService = commandBlockerService ?? throw new ArgumentNullException(nameof(commandBlockerService));
     _inventoryState        = inventoryState ?? throw new ArgumentNullException(nameof(inventoryState));
     _playerState           = playerState ?? throw new ArgumentNullException(nameof(playerState));
     _player = player ?? throw new ArgumentNullException(nameof(player));
 }
Ejemplo n.º 5
0
        public MainScreen(Game game, SpriteBatch spriteBatch) : base(game)
        {
            _spriteBatch = spriteBatch;

            var serviceScope = ((LivGame)Game).ServiceProvider;

            _uiState                 = serviceScope.GetRequiredService <ISectorUiState>();
            _player                  = serviceScope.GetRequiredService <IPlayer>();
            _transitionPool          = serviceScope.GetRequiredService <ITransitionPool>();
            _animationBlockerService = serviceScope.GetRequiredService <IAnimationBlockerService>();

            var uiContentStorage = serviceScope.GetRequiredService <IUiContentStorage>();

            _camera             = new Camera();
            _personEffectsPanel =
                new PersonConditionsPanel(_uiState, screenX: 8, screenY: 8, uiContentStorage: uiContentStorage);

            _personEquipmentModal = new PersonPropsModalDialog(
                uiContentStorage,
                game.GraphicsDevice,
                _uiState,
                ((LivGame)game).ServiceProvider);

            _personStatsModal = new PersonStatsModalDialog(
                uiContentStorage,
                game.GraphicsDevice,
                _uiState);

            _containerModal = new ContainerModalDialog(
                _uiState,
                uiContentStorage,
                Game.GraphicsDevice,
                serviceScope);

            var humanActorTaskSource =
                serviceScope.GetRequiredService <IHumanActorTaskSource <ISectorTaskSourceContext> >();
            var mainPerson = _player.MainPerson;

            if (mainPerson is null)
            {
                throw new InvalidOperationException("Main person is not initalized. Generate globe first.");
            }

            _bottomMenu = new BottomMenuPanel(
                humanActorTaskSource,
                mainPerson.GetModule <ICombatActModule>(),
                uiContentStorage,
                mainPerson.GetModule <IEquipmentModule>(),
                _uiState);
            _bottomMenu.PropButtonClicked += BottomMenu_PropButtonClicked;
            _bottomMenu.StatButtonClicked += BottomMenu_StatButtonClicked;
        }
        public ActorCommonActionMoveEngine(SpriteContainer rootContainer,
                                           IAnimationBlockerService animationBlockerService,
                                           SoundEffectInstance?soundEffect)
        {
            _rootContainer = rootContainer;
            _soundEffect   = soundEffect;

            _startPosition  = rootContainer.Position;
            _targetPosition = _startPosition + (Vector2.UnitY * -10);

            _animationBlocker = new AnimationCommonBlocker();

            animationBlockerService.AddBlocker(_animationBlocker);
        }
        public ActorMeleeAttackEngine(SpriteContainer rootContainer, Vector2 targetPosition,
                                      IAnimationBlockerService animationBlockerService, SoundEffectInstance?meleeAttackSoundEffect)
        {
            _rootContainer           = rootContainer;
            _animationBlockerService = animationBlockerService;
            _meleeAttackSoundEffect  = meleeAttackSoundEffect;
            _startPosition           = rootContainer.Position;
            _targetPosition          = Vector2.Lerp(_startPosition, targetPosition, 0.6f);

            _animationBlocker = new AnimationCommonBlocker();

            _animationBlockerService.AddBlocker(_animationBlocker);

            _rootContainer.FlipX = (_startPosition - _targetPosition).X < 0;
        }
Ejemplo n.º 8
0
        public ActorDamagedEngine(IActorGraphics actorGraphics, SpriteContainer rootSprite, Vector2 attackerPosition,
                                  IAnimationBlockerService animationBlockerService, SoundEffectInstance?soundEffectInstance)
        {
            _actorGraphics       = actorGraphics;
            _rootSprite          = rootSprite;
            _soundEffectInstance = soundEffectInstance;
            var positionDifference = attackerPosition - actorGraphics.RootSprite.Position;
            var hitDirection       = positionDifference;

            hitDirection.Normalize();
            _rootSprite.FlipX = hitDirection.X > 0;
            _startPosition    = rootSprite.Position;
            var oppositeDirection = hitDirection * -1;

            _hitPosition = (oppositeDirection * HIT_DISTANCE) + _startPosition;

            _moveBlocker = new AnimationCommonBlocker();

            animationBlockerService.AddBlocker(_moveBlocker);
        }
Ejemplo n.º 9
0
        public ActorSectorTransitionMoveEngine(SpriteContainer rootContainer,
                                               IAnimationBlockerService animationBlockerService,
                                               SoundEffectInstance?transitionSoundEffect)
        {
            _rootContainer = rootContainer;
            _soundEffect   = transitionSoundEffect;

            _startPosition  = rootContainer.Position;
            _targetPosition = _startPosition + (Vector2.UnitY * -10);

            if (transitionSoundEffect != null)
            {
                _animationBlocker = new SoundAnimationBlocker(transitionSoundEffect);
            }
            else
            {
                _animationBlocker = new AnimationCommonBlocker();
            }

            animationBlockerService.AddBlocker(_animationBlocker);
        }
Ejemplo n.º 10
0
        public ActorPushEngine(SpriteContainer rootSprite, SpriteContainer graphicsRoot, Sprite shadowSprite,
                               Vector2 targetPosition, IAnimationBlockerService animationBlockerService,
                               SoundEffectInstance?soundEffectInstance)
        {
            _rootSprite              = rootSprite;
            _graphicsRoot            = graphicsRoot;
            _shadowSprite            = shadowSprite;
            _startPosition           = rootSprite.Position;
            _targetPosition          = targetPosition;
            _animationBlockerService = animationBlockerService;
            _soundEffectInstance     = soundEffectInstance;

            if (soundEffectInstance != null)
            {
                _moveBlocker = new SoundAnimationBlocker(soundEffectInstance);
            }
            else
            {
                _moveBlocker = new AnimationCommonBlocker();
            }

            _animationBlockerService.AddBlocker(_moveBlocker);
        }