Beispiel #1
0
        public LevelScreen(LoderGame game, SystemManager systemManager, EntityManager entityManager)
            : base(game.screenSystem, ScreenType.Level)
        {
            _game = game;
            _systemManager = systemManager;
            _entityManager = entityManager;
            _levelSystem = (LevelSystem)_systemManager.getSystem(SystemType.Level);
            _content = new ContentManager(_game.Services);
            _content.RootDirectory = "Content";
            _equipmentSystem = (EquipmentSystem)_systemManager.getSystem(SystemType.Equipment);
            _playerId = PlayerSystem.PLAYER_ID;
            _pixel = new Texture2D(_game.GraphicsDevice, 1, 1);
            _pixel.SetData<Color>(new[] { Color.White });
            _arial = _content.Load<SpriteFont>("arial");
            _dialogePanes = new List<InteractiveDialoguePane>();
            _dialogueFont = _content.Load<SpriteFont>("shared_ui/dialogue_font");
            _dialogueOptionFont = _content.Load<SpriteFont>("shared_ui/dialogue_option_font");

            ToolbarComponent toolbarComponent = (ToolbarComponent)_entityManager.getComponent(LevelSystem.currentLevelUid, _playerId, ComponentType.Toolbar);

            _toolbarDisplay = new ToolbarDisplay(_game.spriteBatch, _equipmentSystem, toolbarComponent);
            _inventoryDisplay = new InventoryDisplay(_game.spriteBatch, _equipmentSystem, (InventoryComponent)_entityManager.getComponent(LevelSystem.currentLevelUid, _playerId, ComponentType.Inventory), toolbarComponent);
            _inventoryDisplay.inFocus = false;
            _toolbarDisplay.inFocus = true;

            _healthBar = new LargeHealthBar(_game.spriteBatch);
        }
Beispiel #2
0
        private void closeDialogue()
        {
            DialogueSystem dialogueSystem = _systemManager.getSystem(SystemType.Dialogue) as DialogueSystem;
            string         levelUid       = LevelSystem.currentLevelUid;

            dialogueSystem.endDialogue(levelUid);
        }
Beispiel #3
0
 public EventSystem(SystemManager systemManager, EntityManager entityManager)
 {
     _systemManager = systemManager;
     _entityManager = entityManager;
     _levelSystem = (LevelSystem)_systemManager.getSystem(SystemType.Level);
     _handlers = new Dictionary<GameEventType,Dictionary<int,List<IEventHandler>>>();
 }
Beispiel #4
0
        public RenderSystem(LoderGame game, SystemManager systemManager, EntityManager entityManager)
        {
            _game = game;
            _systemManager = systemManager;
            _entityManager = entityManager;
            _animationManager = game.animationManager;
            //_sortedRenderablePrimitives = new SortedDictionary<float, List<IRenderablePrimitive>>();
            _cameraSystem = _systemManager.getSystem(SystemType.Camera) as CameraSystem;
            _graphicsDevice = game.GraphicsDevice;
            _spriteBatch = game.spriteBatch;
            _backgroundRenderer = new BackgroundRenderer(_spriteBatch);
            _fluidRenderTarget = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _renderedFluid = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _debugFluid = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _postSourceUnder = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);
            _postSourceOver = new RenderTarget2D(_graphicsDevice, _graphicsDevice.Viewport.Width, _graphicsDevice.Viewport.Height);

            _contentManager = new ContentManager(game.Services);
            _contentManager.RootDirectory = "Content";
            _fluidEffect = _contentManager.Load<Effect>("fluid_effect");
            _fluidParticleTexture = _contentManager.Load<Texture2D>("fluid_particle");
            _reticle = _contentManager.Load<Texture2D>("reticle");
            _materialRenderer = new MaterialRenderer(game.GraphicsDevice, _contentManager, game.spriteBatch);
            _primitivesEffect = _contentManager.Load<Effect>("effects/primitives");
            _pixel = new Texture2D(_graphicsDevice, 1, 1);
            _pixel.SetData<Color>(new [] { Color.White });
            _circle = _contentManager.Load<Texture2D>("circle");
            _tooltipFont = _contentManager.Load<SpriteFont>("shared_ui/tooltip_font");
        }
 public AIBehaviorSystem(SystemManager systemManager, EntityManager entityManager)
 {
     _systemManager = systemManager;
     _entityManager = entityManager;
     _levelSystem = _systemManager.getSystem(SystemType.Level) as LevelSystem;
     _random = new Random();
 }
Beispiel #6
0
        public FluidSystem(SystemManager systemManager, EntityManager entityManager)
        {
            _systemManager = systemManager;
            _entityManager = entityManager;

            _physicsSystem = (PhysicsSystem)_systemManager.getSystem(SystemType.Physics);
            _renderSystem = (RenderSystem)_systemManager.getSystem(SystemType.Render);
            fluidGrid = new Dictionary<int, Dictionary<int, List<int>>>();
            liquid = new Particle[MAX_PARTICLES];
            activeParticles = new int[MAX_PARTICLES];
            _simPositions = new Vector2[MAX_PARTICLES];
            _simVelocities = new Vector2[MAX_PARTICLES];
            _delta = new Vector2[MAX_PARTICLES];
            for (int i = 0; i < MAX_PARTICLES; i++)
            {
                liquid[i] = new Particle(this, i, LIQUID_ORIGIN);
            }
        }
Beispiel #7
0
        // Load player inventory
        public static void loadPlayerInventory()
        {
            XElement           inventoryData      = _playerData.Element("InventoryState");
            InventoryComponent inventoryComponent = new InventoryComponent(int.Parse(inventoryData.Attribute("slots").Value));
            EquipmentSystem    equipmentSystem    = _systemManager.getSystem(SystemType.Equipment) as EquipmentSystem;

            _entityManager.addComponent("global", PlayerSystem.PLAYER_ID, inventoryComponent);
            foreach (XElement itemStateData in inventoryData.Elements("ItemState"))
            {
                ItemDefinition itemDefinition = _itemManager.getItemDefinition(itemStateData.Attribute("item_uid").Value);
                ItemState      itemState      = new ItemState(
                    int.Parse(itemStateData.Attribute("quantity").Value),
                    float.Parse(itemStateData.Attribute("current_range_limit").Value),
                    false);
                ItemComponent itemComponent = new ItemComponent(itemDefinition, itemState, ResourceManager.getTexture(itemDefinition.inventoryTextureUid));

                equipmentSystem.addInventoryItem(inventoryComponent, itemComponent);
            }
        }
Beispiel #8
0
        public PhysicsSystem(SystemManager systemManager, EntityManager entityManager)
        {
            _systemManager = systemManager;
            _entityManager = entityManager;
            _bodiesToRemove = new List<Body>();
            _playerSystem = (PlayerSystem)systemManager.getSystem(SystemType.Player);
            _worlds = new Dictionary<string, World>();
            _groundBodies = new Dictionary<string, Body>();
            /*
            // Create world
            _world = new World(gravity);

            // Contact callbacks
            _world.ContactManager.BeginContact += new BeginContactDelegate(BeginContact);
            _world.ContactManager.EndContact += new EndContactDelegate(EndContact);
            _world.ContactManager.PreSolve += new PreSolveDelegate(PreSolve);
            _world.ContactManager.PostSolve += new PostSolveDelegate(PostSolve);

            // Create ground body/entity
            _groundBody = _entityManager.factory.createGroundBody(_world);*/
        }
 public CharacterMovementSystem(SystemManager systemManager, EntityManager entityManager)
 {
     _systemManager = systemManager;
     _entityManager = entityManager;
     _ropeSystem = _systemManager.getSystem(SystemType.Rope) as RopeSystem;
 }