コード例 #1
0
        public override void OnVoxelsDragged(List <VoxelHandle> voxels, InputManager.MouseButton button)
        {
            if (Arguments == null)
            {
                return;
            }

            if (Mouse.GetState().LeftButton == ButtonState.Pressed)
            {
                World.UserInterface.ShowTooltip("Release to build.");
            }
            else
            {
                World.UserInterface.ShowTooltip("Release to cancel.");
            }

            if (Selected == null)
            {
                Selected = new List <VoxelHandle>();
            }
            Selected.Clear();

            foreach (var voxel in voxels)
            {
                Selected.Add(voxel);
            }
        }
コード例 #2
0
        public override void OnBodiesSelected(List <GameComponent> bodies, InputManager.MouseButton button)
        {
            var tasks = new List <Task>();

            foreach (GameComponent animal in bodies.Where(c => c.Tags.Contains("DomesticAnimal")))
            {
                Drawer3D.DrawBox(animal.BoundingBox, Color.Tomato, 0.1f, false);

                switch (button)
                {
                case InputManager.MouseButton.Left:
                    if (CanCatch(World, animal, true) && animal.GetRoot().GetComponent <Creature>().HasValue(out var creature))
                    {
                        tasks.Add(new WrangleAnimalTask(creature)
                        {
                            Priority = TaskPriority.Medium
                        });
                    }
                    break;

                case InputManager.MouseButton.Right:
                    if (World.PersistentData.Designations.GetEntityDesignation(animal, DesignationType.Wrangle).HasValue(out var existingOrder))
                    {
                        World.TaskManager.CancelTask(existingOrder.Task);
                    }
                    break;
                }
            }

            if (tasks.Count > 0)
            {
                World.TaskManager.AddTasks(tasks);
                OnConfirm(World.PersistentData.SelectedMinions);
            }
        }
コード例 #3
0
 public void OnUnitClicked(Unit u, InputManager.MouseButton button)
 {
     if (u == actor)
     {
         OnTileClicked(u.tile, button);
     }
 }
コード例 #4
0
        public override void OnVoxelsSelected(List <VoxelHandle> voxels, InputManager.MouseButton button)
        {
            if (selectedBodies.Count != 0)
            {
                return;
            }

            var v = World.UserInterface.VoxSelector.VoxelUnderMouse;

            if (World.IsBuildDesignation(v))
            {
                World.DestroyBuildDesignation(v);
            }
            else if (World.IsInZone(v))
            {
                var existingRoom = World.GetMostLikelyZone(v);

                if (existingRoom != null)
                {
                    World.UserInterface.Gui.ShowModalPopup(new Gui.Widgets.Confirm
                    {
                        Text    = "Do you want to destroy this " + existingRoom.Type.Name + "?",
                        OnClose = (sender) => destroyDialog_OnClosed((sender as Gui.Widgets.Confirm).DialogResult, existingRoom)
                    });
                }
            }
        }
コード例 #5
0
ファイル: FarmTool.cs プロジェクト: NakedFury/dwarfcorp
        public override void OnBodiesSelected(List <Body> bodies, InputManager.MouseButton button)
        {
            if (Mode == FarmMode.Harvesting)
            {
                List <Body> treesPickedByMouse = ComponentManager.FilterComponentsWithTag("Vegetation", bodies);

                foreach (Body tree in treesPickedByMouse)
                {
                    if (!tree.IsVisible || tree.IsAboveCullPlane)
                    {
                        continue;
                    }

                    Drawer3D.DrawBox(tree.BoundingBox, Color.LightGreen, 0.1f, false);
                    if (button == InputManager.MouseButton.Left)
                    {
                        if (!Player.Faction.ChopDesignations.Contains(tree))
                        {
                            Player.Faction.ChopDesignations.Add(tree);
                        }
                    }
                    else if (button == InputManager.MouseButton.Right)
                    {
                        if (Player.Faction.ChopDesignations.Contains(tree))
                        {
                            Player.Faction.ChopDesignations.Remove(tree);
                        }
                    }
                }
            }
        }
コード例 #6
0
 public override void OnVoxelsSelected(List <VoxelHandle> voxels, InputManager.MouseButton button)
 {
     if (CurrentSpell != null && (CurrentSpell.Mode == Spell.SpellMode.SelectFilledVoxels || CurrentSpell.Mode == Spell.SpellMode.SelectEmptyVoxels))
     {
         CurrentSpell.OnVoxelsSelected(Player.Spells, voxels);
     }
 }
コード例 #7
0
ファイル: MagicTool.cs プロジェクト: svifylabs/dwarfcorp
 public override void OnVoxelsSelected(List <Voxel> voxels, InputManager.MouseButton button)
 {
     if (CurrentSpell != null && (CurrentSpell.Mode == Spell.SpellMode.SelectFilledVoxels || CurrentSpell.Mode == Spell.SpellMode.SelectEmptyVoxels))
     {
         CurrentSpell.OnVoxelsSelected(MagicMenu.SpellTree.Tree, voxels);
     }
 }
コード例 #8
0
        public override void OnBodiesSelected(List <Body> bodies, InputManager.MouseButton button)
        {
            List <Body> resourcesPickedByMouse = ComponentManager.FilterComponentsWithTag("Resource", bodies);
            List <Task> assignments            = new List <Task>();

            foreach (Body resource in resourcesPickedByMouse.Where(resource => resource.IsActive && resource.IsVisible && resource.Parent == PlayState.ComponentManager.RootComponent))
            {
                if (!resource.IsVisible || resource.IsAboveCullPlane)
                {
                    continue;
                }
                Drawer3D.DrawBox(resource.BoundingBox, Color.LightGoldenrodYellow, 0.05f, true);

                if (button == InputManager.MouseButton.Left)
                {
                    Player.Faction.AddGatherDesignation(resource);

                    assignments.Add(new GatherItemTask(resource));
                }
                else
                {
                    if (!Player.Faction.GatherDesignations.Contains(resource))
                    {
                        continue;
                    }

                    Player.Faction.GatherDesignations.Remove(resource);
                }
            }

            TaskManager.AssignTasks(assignments, Faction.FilterMinionsWithCapability(PlayState.Master.SelectedMinions, GameMaster.ToolMode.Gather));
        }
コード例 #9
0
ファイル: PaintRailTool.cs プロジェクト: sodomon2/dwarfcorp
        public override void OnVoxelsSelected(List <VoxelHandle> voxels, InputManager.MouseButton button)
        {
            if (!Dragging)
            {
            }
            else
            {
                if (button == InputManager.MouseButton.Left)
                {
                    if (CanPlace)
                    {
                        RailHelper.Place(World, PreviewBodies, GodModeSwitch);
                    }
                    else
                    {
                        foreach (var piece in PreviewBodies)
                        {
                            piece.GetRoot().Delete();
                        }
                    }

                    PreviewBodies.Clear();
                    PathVoxels.Clear();
                    Dragging = false;
                }
            }
        }
コード例 #10
0
ファイル: MagicTool.cs プロジェクト: svifylabs/dwarfcorp
 public override void OnBodiesSelected(List <Body> bodies, InputManager.MouseButton button)
 {
     if (CurrentSpell != null && CurrentSpell.Mode == Spell.SpellMode.SelectEntities)
     {
         CurrentSpell.OnEntitiesSelected(MagicMenu.SpellTree.Tree, bodies);
     }
 }
コード例 #11
0
ファイル: GatherTool.cs プロジェクト: Echo3ToEcho7/dwarfcorp
        public override void OnBodiesSelected(List <GameComponent> bodies, InputManager.MouseButton button)
        {
            List <Task> assignments = new List <Task>();

            foreach (var resource in bodies.Where(body => CanGather(body)))
            {
                if (World.ChunkManager.IsAboveCullPlane(resource.BoundingBox))
                {
                    continue;
                }

                if (button == InputManager.MouseButton.Left)
                {
                    assignments.Add(new GatherItemTask(resource));
                }
                else if (World.PersistentData.Designations.GetEntityDesignation(resource, DesignationType.Gather).HasValue(out var designation))
                {
                    World.TaskManager.CancelTask(designation.Task);
                }
            }

            World.TaskManager.AddTasks(assignments);

            OnConfirm(Faction.FilterMinionsWithCapability(World.PersistentData.SelectedMinions, TaskCategory.Gather));
        }
コード例 #12
0
ファイル: AttackTool.cs プロジェクト: sodomon2/dwarfcorp
        public override void OnBodiesSelected(List <GameComponent> bodies, InputManager.MouseButton button)
        {
            foreach (GameComponent other in bodies)
            {
                var creature = other.EnumerateAll().OfType <Creature>().FirstOrDefault();
                if (creature == null)
                {
                    continue;
                }

                if (World.Overworld.GetPolitics(creature.Faction.ParentFaction, World.PlayerFaction.ParentFaction).GetCurrentRelationship() == Relationship.Loving)
                {
                    World.UserInterface.ShowToolPopup("We refuse to attack allies.");
                    continue;
                }

                Drawer3D.DrawBox(other.BoundingBox, GameSettings.Current.Colors.GetColor("Hunt", Color.Red), 0.1f, false);

                if (button == InputManager.MouseButton.Left)
                {
                    var task = new KillEntityTask(other, KillEntityTask.KillType.Attack);
                    World.TaskManager.AddTask(task);
                    World.UserInterface.ShowToolPopup("Will attack this " + creature.Stats.CurrentClass.Name);
                    OnConfirm(World.PersistentData.SelectedMinions);
                }
                else if (button == InputManager.MouseButton.Right)
                {
                    if (World.PersistentData.Designations.GetEntityDesignation(other, DesignationType.Attack).HasValue(out var designation))
                    {
                        World.TaskManager.CancelTask(designation.Task);
                        World.UserInterface.ShowToolPopup("Attack cancelled for " + creature.Stats.CurrentClass.Name);
                    }
                }
            }
        }
コード例 #13
0
 public void OnUnitClicked(Unit u, InputManager.MouseButton button)
 {
     if (targetableUnits.Contains(u))
     {
         currentStage.StartCoroutine(onTriggerAttack(u));
     }
 }
コード例 #14
0
        public void VoxelsSelected(List <VoxelHandle> refs, InputManager.MouseButton button)
        {
            foreach (BuildRoomOrder order in BuildDesignations)
            {
                order.SetTint(Color.White);
            }

            foreach (Room room in Faction.GetRooms())
            {
                room.SetTint(Color.White);
            }

            if (CurrentRoomData == null)
            {
                return;
            }

            if (button == InputManager.MouseButton.Left)
            {
                if (CurrentRoomData.Verify(refs, Faction, World))
                {
                    BuildNewVoxels(refs);
                }
            }
        }
コード例 #15
0
 public void OnBodiesSelected(List <Body> bodies, InputManager.MouseButton button)
 {
     CurrentTool.OnBodiesSelected(bodies, button);
     if (CurrentToolMode == ToolMode.SelectUnits)
     {
         SelectedObjects = bodies;
     }
 }
コード例 #16
0
ファイル: PlantTool.cs プロジェクト: polytronicgr/dwarfcorp
 public override void OnVoxelsDragged(List <VoxelHandle> voxels, InputManager.MouseButton button)
 {
     Player.VoxSelector.SelectionColor = Color.White;
     foreach (var voxel in voxels)
     {
         ValidatePlanting(voxel);
     }
 }
コード例 #17
0
ファイル: WallBuilder.cs プロジェクト: NakedFury/dwarfcorp
        public void VoxelsSelected(List <Voxel> refs, InputManager.MouseButton button)
        {
            if (Faction == null)
            {
                Faction = World.PlayerFaction;
            }

            if (CurrentVoxelType == null)
            {
                return;
            }
            Selected.Clear();
            switch (button)
            {
            case (InputManager.MouseButton.Left):
            {
                if (Faction.FilterMinionsWithCapability(Faction.SelectedMinions, GameMaster.ToolMode.Build).Count == 0)
                {
                    World.ShowToolPopup("None of the selected units can build walls.");
                    return;
                }
                List <Task>  assignments = new List <Task>();
                List <Voxel> validRefs   = refs.Where(r => !IsDesignation(r) && r.IsEmpty).ToList();

                if (!Verify(validRefs, CurrentVoxelType.ResourceToRelease))
                {
                    World.ShowToolPopup("Can't build this! Need at least " + validRefs.Count + " " + ResourceLibrary.Resources[CurrentVoxelType.ResourceToRelease].ResourceName + ".");
                    return;
                }

                foreach (Voxel r in validRefs)
                {
                    AddDesignation(new WallBuilder(r, CurrentVoxelType, World));
                    assignments.Add(new BuildVoxelTask(r, CurrentVoxelType));
                }

                TaskManager.AssignTasks(assignments, Faction.FilterMinionsWithCapability(World.Master.SelectedMinions, GameMaster.ToolMode.Build));

                break;
            }

            case (InputManager.MouseButton.Right):
            {
                foreach (Voxel r in refs)
                {
                    if (!IsDesignation(r) || r.TypeName != "empty")
                    {
                        continue;
                    }
                    else
                    {
                        RemoveDesignation(r);
                    }
                }
                break;
            }
            }
        }
コード例 #18
0
 public override void OnBodiesSelected(List <Body> bodies, InputManager.MouseButton button)
 {
     switch (button)
     {
     case InputManager.MouseButton.Left:
         SelectDwarves(bodies);
         break;
     }
 }
コード例 #19
0
ファイル: BuildWallTool.cs プロジェクト: johan74/dwarfcorp
        public override void OnVoxelsSelected(List <VoxelHandle> voxels, InputManager.MouseButton button)
        {
            var Faction = Player.Faction;

            if (CurrentVoxelType == 0)
            {
                return;
            }
            Selected.Clear();
            switch (button)
            {
            case (InputManager.MouseButton.Left):
            {
                List <Task> assignments = new List <Task>();
                var         validRefs   = voxels.Where(r => !Faction.Designations.IsVoxelDesignation(r, DesignationType.Put) &&
                                                       Player.World.Master.VoxSelector.SelectionType == VoxelSelectionType.SelectEmpty ? r.IsEmpty : !r.IsEmpty).ToList();

                foreach (var r in voxels)
                {
                    // Todo: Mode should be a property of the tool, not grabbed out of the vox selector.
                    if (Player.World.Master.VoxSelector.SelectionType == VoxelSelectionType.SelectEmpty && !r.IsEmpty)
                    {
                        continue;
                    }
                    if (Player.World.Master.VoxSelector.SelectionType == VoxelSelectionType.SelectFilled && r.IsEmpty)
                    {
                        continue;
                    }

                    var existingDesignation = Player.Faction.Designations.GetVoxelDesignation(r, DesignationType.Put);
                    if (existingDesignation != null)
                    {
                        Player.TaskManager.CancelTask(existingDesignation.Task);
                    }

                    assignments.Add(new BuildVoxelTask(r, VoxelLibrary.GetVoxelType(CurrentVoxelType).Name));
                }

                //TaskManager.AssignTasks(assignments, Faction.FilterMinionsWithCapability(Player.World.Master.SelectedMinions, GameMaster.ToolMode.BuildZone));
                Player.TaskManager.AddTasks(assignments);
                break;
            }

            case (InputManager.MouseButton.Right):
            {
                foreach (var r in voxels)
                {
                    var designation = Faction.Designations.GetVoxelDesignation(r, DesignationType.Put);
                    if (designation != null)
                    {
                        Player.TaskManager.CancelTask(designation.Task);
                    }
                }
                break;
            }
            }
        }
コード例 #20
0
        public void OnVoxelsDragged(List <VoxelHandle> refs, InputManager.MouseButton button)
        {
            World.Master.VoxSelector.SelectionColor = Color.White;

            if (Faction == null)
            {
                Faction = World.PlayerFaction;
            }

            foreach (BuildRoomOrder order in BuildDesignations)
            {
                order.SetTint(Color.White);
            }

            foreach (Room room in Faction.GetRooms())
            {
                room.SetTint(Color.White);
            }

            if (CurrentRoomData == null)
            {
                return;
            }

            if (button == InputManager.MouseButton.Left)
            {
                World.Tutorial("build " + CurrentRoomData.Name);

                if (CurrentRoomData.Verify(refs, Faction, World))
                {
                    List <Quantitiy <Resource.ResourceTags> > requirements = CurrentRoomData.GetRequiredResources(refs.Count, Faction);

                    string tip = "Needs ";


                    if (requirements.Count == 0)
                    {
                        tip = "";
                    }
                    int i = 0;
                    foreach (var requirement in requirements)
                    {
                        i++;
                        tip += requirement.NumResources.ToString();
                        tip += " ";
                        tip += requirement.ResourceType;
                        tip += "\n";
                    }

                    World.ShowTooltip("Release to build here.");
                }
                else
                {
                    World.Master.VoxSelector.SelectionColor = GameSettings.Default.Colors.GetColor("Negative", Color.Red);
                }
            }
        }
コード例 #21
0
ファイル: DigTool.cs プロジェクト: KingMoo1213/dwarfcorp
        public override void OnVoxelsSelected(List <Voxel> refs, InputManager.MouseButton button)
        {
            if (button == InputManager.MouseButton.Left)
            {
                List <Task> assignments = new List <Task>();
                foreach (Voxel r in refs)
                {
                    if (r == null)
                    {
                        continue;
                    }

                    Voxel v = r;
                    if (v.IsEmpty)
                    {
                        continue;
                    }

                    if (!Player.Faction.IsDigDesignation(v) && !Player.Faction.RoomBuilder.IsInRoom(v))
                    {
                        BuildOrder d = new BuildOrder
                        {
                            Vox = r
                        };
                        Player.Faction.DigDesignations.Add(d);
                    }

                    assignments.Add(new KillVoxelTask(r));
                }

                List <CreatureAI> minions = Faction.FilterMinionsWithCapability(Player.SelectedMinions, GameMaster.ToolMode.Dig);
                TaskManager.AssignTasksGreedy(assignments, minions, 5);
                OnConfirm(minions);
            }
            else
            {
                foreach (Voxel r in refs)
                {
                    if (r == null)
                    {
                        continue;
                    }
                    Voxel v = r;

                    if (v.IsEmpty)
                    {
                        continue;
                    }

                    if (Player.Faction.IsDigDesignation(v))
                    {
                        Player.Faction.DigDesignations.Remove(Player.Faction.GetDigDesignation(v));
                    }
                }
            }
        }
コード例 #22
0
ファイル: GodModeTool.cs プロジェクト: Echo3ToEcho7/dwarfcorp
 public override void OnBodiesSelected(List <GameComponent> bodies, InputManager.MouseButton button)
 {
     if (Command.Contains("Kill Things"))
     {
         foreach (var root in bodies.Where(c => c.IsRoot()))
         {
             root.Die();
         }
     }
 }
コード例 #23
0
        public override void OnVoxelsSelected(List <VoxelHandle> voxels, InputManager.MouseButton button)
        {
            switch (button)
            {
            case (InputManager.MouseButton.Left):
            {
                if (ObjectHelper.IsValidPlacement(World.UserInterface.VoxSelector.VoxelUnderMouse, CraftType, World, PreviewBody, "build", "built"))
                {
                    PreviewBody.SetFlag(GameComponent.Flag.ShouldSerialize, true);

                    Vector3 pos      = World.UserInterface.VoxSelector.VoxelUnderMouse.WorldPosition + new Vector3(0.5f, 0.0f, 0.5f) + CraftType.Placement_SpawnOffset;
                    Vector3 startPos = pos + new Vector3(0.0f, -0.1f, 0.0f);

                    var newDesignation = new PlacementDesignation()
                    {
                        ItemType            = CraftType,
                        Location            = World.UserInterface.VoxSelector.VoxelUnderMouse,
                        Orientation         = Orientation,
                        OverrideOrientation = OverrideOrientation,
                        Entity   = PreviewBody,
                        WorkPile = new WorkPile(World.ComponentManager, startPos)
                    };

                    World.ComponentManager.RootComponent.AddChild(newDesignation.WorkPile);
                    newDesignation.WorkPile.AnimationQueue.Add(new EaseMotion(1.1f, Matrix.CreateTranslation(startPos), pos));
                    World.ParticleManager.Trigger("puff", pos, Color.White, 10);

                    World.TaskManager.AddTask(new PlaceObjectTask(newDesignation));

                    if (!HandlePlaceExistingUpdate())
                    {
                        PreviewBody = null;
                        World.UserInterface.ShowToolPopup("Unable to place any more.");
                        World.UserInterface.ChangeTool("SelectUnits");
                    }
                    else
                    {
                        PreviewBody = CreatePreviewBody();
                    }
                }

                break;
            }

            case (InputManager.MouseButton.Right):
            {
                var designation = World.PersistentData.Designations.EnumerateEntityDesignations(DesignationType.PlaceObject).Select(d => d.Tag as PlacementDesignation).FirstOrDefault(d => d.Location == World.UserInterface.VoxSelector.VoxelUnderMouse);
                if (designation != null && World.PersistentData.Designations.GetEntityDesignation(designation.Entity, DesignationType.PlaceObject).HasValue(out var realDesignation))
                {
                    World.TaskManager.CancelTask(realDesignation.Task);
                }
                break;
            }
            }
        }
コード例 #24
0
ファイル: PlantTool.cs プロジェクト: polytronicgr/dwarfcorp
        public override void OnVoxelsSelected(List <VoxelHandle> voxels, InputManager.MouseButton button)
        {
            if (button == InputManager.MouseButton.Left)
            {
                var goals = new List <PlantTask>();
                int count = Player.Faction.Designations.EnumerateDesignations(DesignationType.Plant).Count();

                foreach (var voxel in voxels)
                {
                    if (count >= 1024)
                    {
                        Player.World.ShowToolPopup("Too many planting tasks.");
                        break;
                    }
                    if (ValidatePlanting(voxel))
                    {
                        count++;
                        var farmTile = new Farm
                        {
                            Voxel             = voxel,
                            RequiredResources = RequiredResources,
                            SeedResourceType  = PlantType
                        };

                        var task = new PlantTask(farmTile)
                        {
                            Plant             = PlantType,
                            RequiredResources = RequiredResources
                        };

                        if (voxel.Type.Name != "TilledSoil")
                        {
                            farmTile.TargetProgress = 200.0f; // Planting on untilled soil takes longer.
                        }
                        goals.Add(task);
                    }
                }

                Player.TaskManager.AddTasks(goals);

                OnConfirm(Player.World.Master.Faction.Minions.Where(minion => minion.Stats.IsTaskAllowed(Task.TaskCategory.Plant)).ToList());
            }
            else if (button == InputManager.MouseButton.Right)
            {
                foreach (var voxel in voxels)
                {
                    var designation = Player.Faction.Designations.GetVoxelDesignation(voxel, DesignationType.Plant);

                    if (designation != null)
                    {
                        Player.TaskManager.CancelTask(designation.Task);
                    }
                }
            }
        }
コード例 #25
0
        private DestroyZoneTool DestroyZoneTool; // I should probably be fired for this.

        public override void OnVoxelsSelected(List <VoxelHandle> voxels, InputManager.MouseButton button)
        {
            if (button == InputManager.MouseButton.Left)
            {
                Player.Faction.RoomBuilder.VoxelsSelected(voxels, button);
            }
            else
            {
                DestroyZoneTool.OnVoxelsSelected(voxels, button);
            }
        }
コード例 #26
0
 private void InputManager_MouseClickedCallback(InputManager.MouseButton button)
 {
     if (ClickTimer.HasTriggered && !IsDead)
     {
         OnSelectionModified.Invoke(CurrentValue);
         Parent.RemoveChild(this);
         Box.Selector = null;
         IsDead       = true;
         InputManager.MouseClickedCallback -= InputManager_MouseClickedCallback;
     }
 }
コード例 #27
0
 private void InputManager_MouseClickedCallback(InputManager.MouseButton button)
 {
     if (IsMouseOver && IsEditable)
     {
         HasKeyboardFocus = true;
     }
     else
     {
         HasKeyboardFocus = false;
     }
 }
コード例 #28
0
        private DestroyZoneTool DestroyZoneTool; // I should probably be fired for this.

        public override void OnVoxelsSelected(List <VoxelHandle> voxels, InputManager.MouseButton button)
        {
            if (button == InputManager.MouseButton.Left)
            {
                foreach (BuildZoneOrder order in World.PersistentData.BuildDesignations)
                {
                    order.SetTint(Color.White);
                }

                foreach (var room in World.EnumerateZones())
                {
                    room.SetTint(Color.White);
                }

                if (CurrentZoneType == null)
                {
                    return;
                }

                if (button == InputManager.MouseButton.Left)
                {
                    if (CurrentZoneType.CanBuildHere(voxels, World))
                    {
                        if (Library.CreateZone(CurrentZoneType.Name, World).HasValue(out var toBuild))
                        {
                            var order = new BuildZoneOrder(toBuild, World);
                            World.PersistentData.BuildDesignations.Add(order);
                            World.PersistentData.Zones.Add(toBuild);

                            foreach (var v in voxels.Where(v => v.IsValid && !v.IsEmpty))
                            {
                                order.VoxelOrders.Add(new BuildVoxelOrder(order, order.ToBuild, v));
                            }

                            order.WorkObjects.AddRange(Fence.CreateFences(World.ComponentManager,
                                                                          ContentPaths.Entities.DwarfObjects.constructiontape,
                                                                          order.VoxelOrders.Select(o => o.Voxel),
                                                                          true));
                            foreach (var obj in order.WorkObjects)
                            {
                                obj.Manager.RootComponent.AddChild(obj);
                            }

                            World.TaskManager.AddTask(new BuildZoneTask(order));
                        }
                    }
                }
            }
            else
            {
                DestroyZoneTool.OnVoxelsSelected(voxels, button);
            }
        }
コード例 #29
0
 public override void OnVoxelsSelected(List <VoxelHandle> voxels, InputManager.MouseButton button)
 {
     if (button == InputManager.MouseButton.Left)
     {
         if (RailHelper.CanPlace(Player, PreviewBodies))
         {
             RailHelper.Place(Player, PreviewBodies, GodModeSwitch);
             PreviewBodies.Clear();
             CreatePreviewBodies(Player.World.ComponentManager, Player.VoxSelector.VoxelUnderMouse);
         }
     }
 }
コード例 #30
0
ファイル: PaintRailTool.cs プロジェクト: hhy5277/dwarfcorp
 public override void OnVoxelsDragged(List <VoxelHandle> voxels, InputManager.MouseButton button)
 {
     if (!Dragging)
     {
         Dragging       = true;
         DragStartVoxel = World.UserInterface.VoxSelector.FirstVoxel;
         StartingOppositeOrientation = CompassOrientation.North;
         OverrideStartingOrientation = false;
         EndingOppositeOrientation   = CompassOrientation.North;
         OverrideEndingOrientation   = false;
     }
 }