Esempio n. 1
0
        public static void InitializeTool(Game1 inGame, Editor inEditor)
        {
            game     = inGame;
            editor   = inEditor;
            toolType = NPCToolType.PlaceNPC;

            PathTool.InitializeTool(inGame, inEditor);

            wanderHud         = game.Content.Load <Texture2D>("Textures\\wander_hud");
            wanderHudLocation = new Rectangle(0, 0, wanderHud.Width, wanderHud.Height);
        }
Esempio n. 2
0
        public static void EndSetWander()
        {
            int selX = game.selectedX;
            int selY = game.selectedY;

            wanderLoc2 = new Point(selX, selY);

            Microsoft.Xna.Framework.Rectangle wanderArea = new Microsoft.Xna.Framework.Rectangle(
                Math.Min(wanderLoc1.X, wanderLoc2.X),
                Math.Min(wanderLoc1.Y, wanderLoc2.Y),
                Math.Abs(wanderLoc1.X - wanderLoc2.X) + 1,
                Math.Abs(wanderLoc1.Y - wanderLoc2.Y) + 1);

            //if we are editing an NPC then set it's wander area
            if (editor.NPCEditRadio.Checked && editor.activeNPCEdit != null)
            {
                editor.activeNPCEdit.SetWanderArea(wanderArea);

                //if the npc is not in the wander area
                if (!wanderArea.Contains(editor.activeNPCEdit.tileCoords))
                {
                    //set the NPC to the top left corner of the area
                    game.world.currentArea.tile[editor.activeNPCEdit.tileCoords.X, editor.activeNPCEdit.tileCoords.Y].setOccupied(false);
                    for (int y = wanderArea.Y; y < wanderArea.Y + wanderArea.Height; y++)
                    {
                        for (int x = wanderArea.X; x < wanderArea.X + wanderArea.Width; x++)
                        {
                            if (game.world.currentArea.tile[x, y].isClear())
                            {
                                editor.activeNPCEdit.tileCoords = new Microsoft.Xna.Framework.Point(x, y);
                                game.world.currentArea.tile[x, y].setOccupied(true);
                                //exit the loop
                                y = wanderArea.Y + wanderArea.Height;
                                break;
                            }
                        }
                    }
                }
                toolType = NPCToolType.EditNPC;
            }
            else
            {
                toolType = NPCToolType.EditNPC;
            }
        }
Esempio n. 3
0
 public static void StartPath()
 {
     toolType = NPCToolType.SetPath;
     PathTool.StartPath();
 }