Esempio n. 1
0
        public override void Update(DwarfTime time, VoxelSelector voxSelector, BodySelector bodySelector)
        {
            SelectionTimer.Update(time);
            if (SelectionTimer.HasTriggered)
            {
                if (Type == InspectType.InspectEntity)
                {
                    MouseState  mouse    = Mouse.GetState();
                    List <Body> selected = bodySelector.SelectBodies(new Rectangle(mouse.X - 10, mouse.Y - 10, 20, 20));

                    if (selected.Count > 0)
                    {
                        OnEntitiesSelected(PlayState.Master.Spells, selected);
                    }
                }
                else
                {
                    Voxel vox = new Voxel();
                    PlayState.ChunkManager.ChunkData.GetNonNullVoxelAtWorldLocation(PlayState.CursorLightPos, ref vox);

                    OnVoxelsSelected(PlayState.Master.Spells, new List <Voxel>()
                    {
                        vox
                    });
                }
            }
            base.Update(time, voxSelector, bodySelector);
        }
Esempio n. 2
0
        public override void Update(DwarfTime time, VoxelSelector voxSelector, BodySelector bodySelector)
        {
            SelectionTimer.Update(time);
            if (SelectionTimer.HasTriggered)
            {
                if (Type == InspectType.InspectEntity)
                {
                    MouseState  mouse    = Mouse.GetState();
                    List <Body> selected = bodySelector.SelectBodies(new Rectangle(mouse.X - 10, mouse.Y - 10, 20, 20));

                    if (selected.Count > 0)
                    {
                        OnEntitiesSelected(World.Master.Spells, selected);
                    }
                }
                else
                {
                    var vox = new VoxelHandle(World.ChunkManager.ChunkData,
                                              GlobalVoxelCoordinate.FromVector3(World.CursorLightPos));
                    if (vox.IsValid)
                    {
                        OnVoxelsSelected(World.Master.Spells, new List <VoxelHandle>()
                        {
                            vox
                        });
                    }
                }
            }
            base.Update(time, voxSelector, bodySelector);
        }
Esempio n. 3
0
        public void Initialize(DwarfGame game, ComponentManager components, ChunkManager chunks, OrbitCamera camera, GraphicsDevice graphics)
        {
            CameraController = camera;
            VoxSelector      = new VoxelSelector(World);
            BodySelector     = new BodySelector(CameraController, GameState.Game.GraphicsDevice, components);
            SelectedMinions  = new List <CreatureAI>();

            CreateTools();

            //InputManager.KeyReleasedCallback += OnKeyReleased;
            //InputManager.KeyPressedCallback += OnKeyPressed;
        }
Esempio n. 4
0
        public void Initialize(DwarfGame game, ComponentManager components, ChunkManager chunks, Camera camera, GraphicsDevice graphics, DwarfGUI gui)
        {
            RoomLibrary.InitializeStatics();

            CameraController = camera;
            VoxSelector      = new VoxelSelector(World, CameraController, chunks.Graphics, chunks);
            BodySelector     = new BodySelector(CameraController, chunks.Graphics, components);
            GUI             = gui;
            SelectedMinions = new List <CreatureAI>();
            Spells          = SpellLibrary.CreateSpellTree(components.World);
            CreateTools();

            InputManager.KeyReleasedCallback += OnKeyReleased;

            Debugger = new AIDebugger(GUI, this);
        }
Esempio n. 5
0
        public void Initialize(DwarfGame game, ComponentManager components, ChunkManager chunks, OrbitCamera camera, GraphicsDevice graphics)
        {
            RoomLibrary.InitializeStatics();

            CameraController = camera;
            VoxSelector      = new VoxelSelector(World, CameraController, GameState.Game.GraphicsDevice, chunks);
            BodySelector     = new BodySelector(CameraController, GameState.Game.GraphicsDevice, components);
            SelectedMinions  = new List <CreatureAI>();

            if (Spells == null)
            {
                Spells = SpellLibrary.CreateSpellTree(components.World);
            }
            CreateTools();

            //InputManager.KeyReleasedCallback += OnKeyReleased;
            //InputManager.KeyPressedCallback += OnKeyPressed;
        }
Esempio n. 6
0
        public void Initialize(DwarfGame game, ComponentManager components, ChunkManager chunks, Camera camera, GraphicsDevice graphics, DwarfGUI gui)
        {
            RoomLibrary.InitializeStatics();

            CameraController = camera;
            VoxSelector      = new VoxelSelector(CameraController, chunks.Graphics, chunks);
            BodySelector     = new BodySelector(CameraController, chunks.Graphics, components);
            GUI             = gui;
            SelectedMinions = new List <CreatureAI>();
            Spells          = SpellLibrary.CreateSpellTree();
            CreateTools();

            InputManager.KeyReleasedCallback += OnKeyReleased;
            ToolBar = new MasterControls(GUI, GUI.RootComponent, this, TextureManager.GetTexture(ContentPaths.GUI.icons), graphics, game.Content.Load <SpriteFont>(ContentPaths.Fonts.Default))
            {
                Master = this
            };

            Debugger = new AIDebugger(GUI, this);
        }
Esempio n. 7
0
        public virtual void Update(DwarfTime time, VoxelSelector voxSelector, BodySelector bodySelector)
        {
            if (Recharges)
            {
                RechargeTimer.Update(time);
            }

            switch (Mode)
            {
            case SpellMode.Button:
                break;

            case SpellMode.Continuous:
                OnContinuousUpdate(time);
                break;

            case SpellMode.SelectEmptyVoxels:
                voxSelector.SelectionType = VoxelSelectionType.SelectEmpty;
                voxSelector.Enabled       = true;
                bodySelector.Enabled      = false;
                break;

            case SpellMode.SelectFilledVoxels:
                voxSelector.SelectionType = VoxelSelectionType.SelectFilled;
                voxSelector.Enabled       = true;
                bodySelector.Enabled      = false;
                break;

            case SpellMode.SelectEntities:
                bodySelector.Enabled = true;
                break;
            }

            if (!Recharges || RechargeTimer.HasTriggered)
            {
                World.ParticleManager.Trigger("star_particle", World.CursorLightPos + Vector3.Up * 0.5f, Color.White, 2);
            }
        }
Esempio n. 8
0
        public void Initialize(DwarfGame game, ComponentManager components, ChunkManager chunks, Camera camera, GraphicsDevice graphics, DwarfGUI gui)
        {
            RoomLibrary.InitializeStatics();

            CameraController = camera;
            VoxSelector = new VoxelSelector(CameraController, chunks.Graphics, chunks);
            BodySelector = new BodySelector(CameraController, chunks.Graphics, components);
            GUI = gui;
            SelectedMinions = new List<CreatureAI>();
            Spells = SpellLibrary.CreateSpellTree();
            CreateTools();

            InputManager.KeyReleasedCallback += OnKeyReleased;
            ToolBar = new MasterControls(GUI, GUI.RootComponent, this, TextureManager.GetTexture(ContentPaths.GUI.icons), graphics, game.Content.Load<SpriteFont>(ContentPaths.Fonts.Default))
            {
                Master = this
            };

            Debugger = new AIDebugger(GUI, this);
        }
Esempio n. 9
0
        public virtual void Update(DwarfTime time, VoxelSelector voxSelector, BodySelector bodySelector)
        {
            if(Recharges)
                RechargeTimer.Update(time);

            switch (Mode)
            {
                case SpellMode.Button:
                    break;
                case SpellMode.Continuous:
                    OnContinuousUpdate(time);
                    break;
                case SpellMode.SelectEmptyVoxels:
                    voxSelector.SelectionType = VoxelSelectionType.SelectEmpty;
                    voxSelector.Enabled = true;
                    bodySelector.Enabled = false;
                    break;
                case SpellMode.SelectFilledVoxels:
                    voxSelector.SelectionType = VoxelSelectionType.SelectFilled;
                    voxSelector.Enabled = true;
                    bodySelector.Enabled = false;
                    break;
                case SpellMode.SelectEntities:
                    bodySelector.Enabled = true;
                    break;
            }

            if (!Recharges || RechargeTimer.HasTriggered)
            {
                PlayState.ParticleManager.Trigger("star_particle", PlayState.CursorLightPos + Vector3.Up * 0.5f, Color.White, 2);
            }
        }
Esempio n. 10
0
        public override void Update(DwarfTime time, VoxelSelector voxSelector, BodySelector bodySelector)
        {
            SelectionTimer.Update(time);
            if (SelectionTimer.HasTriggered)
            {
                if (Type == InspectType.InspectEntity)
                {
                    MouseState mouse = Mouse.GetState();
                    List<Body> selected = bodySelector.SelectBodies(new Rectangle(mouse.X - 10, mouse.Y - 10, 20, 20));

                    if (selected.Count > 0)
                    {
                        OnEntitiesSelected(PlayState.Master.Spells, selected);
                    }
                }
                else
                {
                    Voxel vox = new Voxel();
                    PlayState.ChunkManager.ChunkData.GetNonNullVoxelAtWorldLocation(PlayState.CursorLightPos, ref vox);

                    OnVoxelsSelected(PlayState.Master.Spells, new List<Voxel>(){vox});
                }
            }
            base.Update(time, voxSelector, bodySelector);
        }