예제 #1
0
        void InputManager_MouseClickedCallback(InputManager.MouseButton button)
        {
            if (button != InputManager.MouseButton.Right || World.UserInterface.CurrentTool != this || KeyManager.RotationEnabled(World.Renderer.Camera))
            {
                return;
            }

            var mouseState = KeyManager.TrueMousePos;

            var vox = VoxelHelpers.FindFirstVisibleVoxelOnScreenRay(
                World.ChunkManager,
                mouseState.X, mouseState.Y,
                World.Renderer.Camera,
                GameState.Game.GraphicsDevice.Viewport,
                150.0f,
                false,
                voxel => voxel.IsValid && (!voxel.IsEmpty || voxel.LiquidLevel > 0));

            if (!vox.IsValid)
            {
                return;
            }

            foreach (CreatureAI minion in World.PersistentData.SelectedMinions)
            {
                if (minion.Creature.Stats.IsAsleep)
                {
                    continue;
                }

                if (minion.CurrentTask.HasValue(out var currentTask))
                {
                    minion.AssignTask(currentTask); // Make sure the minion keeps the current task - avoided if the task stays in their queue in the first place!
                }
                var above = VoxelHelpers.GetVoxelAbove(vox);
                if (above.IsValid)
                {
                    minion.Blackboard.SetData("MoveTarget", above);

                    var moveTask = new ActWrapperTask(new GoToNamedVoxelAct("MoveTarget", PlanAct.PlanType.Adjacent, minion));
                    moveTask.AutoRetry = false;
                    moveTask.Priority  = TaskPriority.Urgent;
                    minion.ChangeTask(moveTask);
                }
            }
            OnConfirm(World.PersistentData.SelectedMinions);

            if (World.PersistentData.SelectedMinions.Count > 0)
            {
                IndicatorManager.DrawIndicator(IndicatorManager.StandardIndicators.DownArrow, vox.WorldPosition + Vector3.One * 0.5f, 0.5f, 2.0f, new Vector2(0, -50), Color.LightGreen);
            }
        }
예제 #2
0
 public void GatherSkeletons()
 {
     foreach (Skeleton skeleton in Skeletons)
     {
         Vector3 offset = Position - skeleton.AI.Position;
         float   dist   = (offset).Length();
         if (dist > 4 && skeleton.AI.Tasks.Count <= 1)
         {
             Task goToTask = new ActWrapperTask(new GoToEntityAct(Physics, skeleton.AI))
             {
                 Priority = Task.PriorityType.High
             };
             if (!skeleton.AI.Tasks.Contains(goToTask))
             {
                 skeleton.AI.AssignTask(goToTask);
             }
         }
     }
 }
예제 #3
0
        public void GatherSkeletons()
        {
            foreach (var skeleton in Skeletons)
            {
                var offset = Position - skeleton.AI.Position;
                if (offset.Length() > 4 && skeleton.AI.Tasks.Count <= 1)
                {
                    var goToTask = new ActWrapperTask(new GoToEntityAct(Physics, skeleton.AI))
                    {
                        Priority = TaskPriority.High
                    };

                    if (!skeleton.AI.Tasks.Contains(goToTask))
                    {
                        skeleton.AI.AssignTask(goToTask);
                    }
                }
            }
        }
예제 #4
0
 public void GatherSkeletons()
 {
     foreach (Skeleton skeleton in Skeletons)
     {
         Vector3 offset = Position - skeleton.AI.Position;
         float dist = (offset).Length();
         if (dist > 4 && skeleton.AI.Tasks.Count <= 1)
         {
             Task goToTask = new ActWrapperTask(new GoToEntityAct(Physics, skeleton.AI))
             {
                 Priority = Task.PriorityType.High
             };
             if (!skeleton.AI.Tasks.Contains(goToTask))
             {
                 skeleton.AI.Tasks.Add(goToTask);
             }
         }
     }
 }