Exemplo n.º 1
0
        // Called when the item is added to the inventory list
        public override void OnAdded(Inventory inventory)
        {
            base.OnAdded(inventory);

            this.currentAmmo = 0;
            this.ammo = new Ammo[] {
                inventory.GetAmmo("ammo_bombs")
            };
        }
Exemplo n.º 2
0
 //-----------------------------------------------------------------------------
 // Constructor
 //-----------------------------------------------------------------------------
 protected Item()
 {
     this.inventory		= null;
     this.id				= "";
     this.name			= new string[] { "" };
     this.description	= new string[] { "" };
     this.level			= Item.Level1;
     this.maxLevel		= Item.Level1;
     this.isObtained		= false;
     this.isStolen		= false;
     this.sprite			= null;
 }
Exemplo n.º 3
0
        // Called when the item is added to the inventory list
        public override void OnAdded(Inventory inventory)
        {
            base.OnAdded(inventory);
            int[] maxAmounts = { 10, 20, 30 };

            this.currentAmmo = 0;
            this.ammo = new Ammo[] {
                inventory.AddAmmo(
                    new Ammo(
                        "ammo_bombs", "Bombs", "Very explosive.",
                        new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(13, 0)),
                        maxAmounts[level], maxAmounts[level]
                    ),
                    false
                )
            };
        }
Exemplo n.º 4
0
 //-----------------------------------------------------------------------------
 // Constructor
 //-----------------------------------------------------------------------------
 public GameControl(GameManager gameManager)
 {
     this.gameManager		= gameManager;
     this.roomStateStack		= null;
     this.roomControl		= null;
     this.world				= null;
     this.player				= null;
     this.hud				= null;
     this.inventory			= null;
     this.rewardManager		= null;
     this.isAdvancedGame		= false;
     this.updateRoom			= true;
     this.animateRoom		= true;
     this.menuWeapons		= null;
     this.menuSecondaryItems	= null;
     this.menuEssences		= null;
 }
Exemplo n.º 5
0
        // Start a new game.
        public void StartGame()
        {
            roomTicks = 0;

            // Setup the player beforehand so certain classes such as the HUD can reference it
            player = new Player();

            inventory						= new Inventory(this);
            menuWeapons						= new MenuWeapons(gameManager);
            menuSecondaryItems				= new MenuSecondaryItems(gameManager);
            menuEssences					= new MenuEssences(gameManager);
            menuWeapons.PreviousMenu		= menuEssences;
            menuWeapons.NextMenu			= menuSecondaryItems;
            menuSecondaryItems.PreviousMenu	= menuWeapons;
            menuSecondaryItems.NextMenu		= menuEssences;
            menuEssences.PreviousMenu		= menuSecondaryItems;
            menuEssences.NextMenu			= menuWeapons;

            mapDungeon = new ScreenDungeonMap(gameManager);

            GameData.LoadInventory(inventory, true);

            inventory.ObtainAmmo("ammo_ember_seeds");
            inventory.ObtainAmmo("ammo_scent_seeds");
            inventory.ObtainAmmo("ammo_pegasus_seeds");
            inventory.ObtainAmmo("ammo_gale_seeds");
            inventory.ObtainAmmo("ammo_mystery_seeds");

            hud = new HUD(this);
            hud.DynamicHealth = player.Health;

            rewardManager = new RewardManager(this);
            GameData.LoadRewards(rewardManager);
            dropManager = new DropManager(this);
            GameData.LoadDrops(dropManager, rewardManager);

            // Create the script runner.
            scriptRunner = new ScriptRunner(this);

            // Create the room control.
            roomControl = new RoomControl();
            gameManager.PushGameState(roomControl);

            // Load the world.
            //WorldFile worldFile = new WorldFile();
            //world = worldFile.Load("Content/Worlds/temp_world.zwd");

            // Begin the room state.
            if (gameManager.LaunchParameters.Length > 0) {
                LoadWorld(gameManager.LaunchParameters[0]);

                if (gameManager.LaunchParameters.Length > 1 && gameManager.LaunchParameters[1] == "-test") {
                    // Launch parameters can define player's start position.
                    int startLevel = Int32.Parse(gameManager.LaunchParameters[2]);
                    int startRoomX = Int32.Parse(gameManager.LaunchParameters[3]);
                    int startRoomY = Int32.Parse(gameManager.LaunchParameters[4]);
                    int startPlayerX = Int32.Parse(gameManager.LaunchParameters[5]);
                    int startPlayerY = Int32.Parse(gameManager.LaunchParameters[6]);

                    player.SetPositionByCenter(new Point2I(startPlayerX, startPlayerY) * GameSettings.TILE_SIZE + new Point2I(8, 8));
                    player.MarkRespawn();
                    roomControl.BeginRoom(world.Levels[startLevel].Rooms[startRoomX, startRoomY]);
                }
                else {
                    player.SetPositionByCenter(world.StartTileLocation * GameSettings.TILE_SIZE + new Point2I(8, 8));
                    player.MarkRespawn();
                    roomControl.BeginRoom(world.StartRoom);
                }
            }
            else {
                //WorldFile worldFile = new WorldFile();
                //world = worldFile.Load("temp_world.zwd");
                LoadWorld(GameDebug.CreateTestWorld());
                player.SetPositionByCenter(world.StartTileLocation * GameSettings.TILE_SIZE + new Point2I(8, 8));
                player.MarkRespawn();
                roomControl.BeginRoom(world.StartRoom);
            }
            roomStateStack = new RoomStateStack(new RoomStateNormal());
            roomStateStack.Begin(this);

            if (!roomControl.Room.IsHiddenFromMap)
                lastRoomOnMap = roomControl.Room;

            AudioSystem.MasterVolume = 0.04f; // The way David likes it.
        }
Exemplo n.º 6
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public EditorControl()
        {
            this.propertyGridControl	= null;
            this.worldFilePath	= String.Empty;
            this.worldFileName	= "untitled";
            this.world			= null;
            this.level			= null;
            this.tileset		= null;
            this.zone			= null;
            this.rewardManager	= null;
            this.inventory		= null;
            this.timer			= null;
            this.ticks			= 0;
            this.roomSpacing	= 1;
            this.playAnimations	= false;
            this.isInitialized	= false;
            this.hasMadeChanges	= false;

            this.currentLayer				= 0;
            this.currentToolIndex			= 0;
            this.aboveTileDrawMode			= TileDrawModes.Fade;
            this.belowTileDrawMode			= TileDrawModes.Fade;
            this.showRewards				= true;
            this.showGrid					= false;
            this.showEvents					= false;
            this.highlightMouseTile			= true;
            this.selectedRoom				= -Point2I.One;
            this.selectedTile				= -Point2I.One;
            this.selectedTilesetTile		= Point2I.Zero;
            this.selectedTilesetTileData	= null;
            this.playerPlaceMode			= false;
            this.sampleFromAllLayers		= false;
        }
Exemplo n.º 7
0
        public void Initialize(ContentManager contentManager, GraphicsDevice graphicsDevice)
        {
            if (!isInitialized) {
                Resources.Initialize(contentManager, graphicsDevice);
                GameData.Initialize();
                EditorResources.Initialize();

                this.inventory		= new Inventory(null);
                this.rewardManager	= new RewardManager(null);
                this.timer			= Stopwatch.StartNew();
                this.ticks			= 0;
                this.roomSpacing	= 1;
                this.playAnimations = false;
                this.tileset		= GameData.TILESET_CLIFFS;
                this.zone			= GameData.ZONE_PRESENT;
                this.selectedTilesetTileData = this.tileset.TileData[0, 0];
                this.eventMode		= false;

                GameData.LoadInventory(inventory);
                GameData.LoadRewards(rewardManager);

                // Create tileset combo box.
                editorForm.ComboBoxTilesets.Items.Clear();
                foreach (KeyValuePair<string, Tileset> entry in Resources.GetResourceDictionary<Tileset>()) {
                    editorForm.ComboBoxTilesets.Items.Add(entry.Key);
                }
                editorForm.ComboBoxTilesets.SelectedIndex = 0;

                // Create zone combo box.
                editorForm.ComboBoxZones.Items.Clear();
                foreach (KeyValuePair<string, Zone> entry in Resources.GetResourceDictionary<Zone>()) {
                    if (tileset.SpriteSheet.Image.HasVariant(entry.Key))
                        editorForm.ComboBoxZones.Items.Add(entry.Key);
                }
                editorForm.ComboBoxZones.SelectedIndex = 0;

                // Create controllers.
                propertyGridControl = new PropertyGridControl(this, editorForm.PropertyGrid);

                // Create tools.
                tools = new List<EditorTool>();
                AddTool(toolPointer		= new ToolPointer());
                AddTool(toolPlace		= new ToolPlace());
                AddTool(toolSelection	= new ToolSelection());
                AddTool(toolEyedrop		= new ToolEyedrop());
                currentToolIndex = 0;
                tools[currentToolIndex].OnBegin();

                this.isInitialized = true;
            }
        }
Exemplo n.º 8
0
 //-----------------------------------------------------------------------------
 // Virtual
 //-----------------------------------------------------------------------------
 // Called when the item is added to the inventory list.
 public virtual void OnAdded(Inventory inventory)
 {
     this.inventory = inventory;
 }
Exemplo n.º 9
0
        //-----------------------------------------------------------------------------
        // Inventory Loading
        //-----------------------------------------------------------------------------
        public static void LoadInventory(Inventory inventory, bool obtain = false)
        {
            // Add ammos.
            inventory.AddAmmos(false,
                new AmmoSatchelSeeds("ammo_ember_seeds", "Ember Seeds", "A burst of fire!",
                    new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(0, 3)), 0, 20),
                new AmmoSatchelSeeds("ammo_scent_seeds", "Scent Seeds", "An aromatic blast!",
                    new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(1, 3)), 0, 20),
                new AmmoSatchelSeeds("ammo_pegasus_seeds", "Pegasus Seeds", "Steals speed?",
                    new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(2, 3)), 0, 20),
                new AmmoSatchelSeeds("ammo_gale_seeds", "Gale Seeds", "A mighty blow!",
                    new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(3, 3)), 0, 20),
                new AmmoSatchelSeeds("ammo_mystery_seeds", "Mystery Seeds", "A producer of unknown effects.",
                    new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(4, 3)), 0, 20),
                new Ammo("ammo_bombs", "Bombs", "Very explosive.",
                    new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(13, 0)), 0, 10),
                new Ammo("ammo_arrows", "Arrows", "A standard arrow.",
                    new Sprite(GameData.SHEET_ITEMS_SMALL, new Point2I(15, 1)), 0, 30)
            );

            // Add weapons.
            inventory.AddItems(obtain,
                // Currently equipped items:
                new ItemCane(),
                new ItemFeather(),

                // Items in inventory menu:
                new ItemSword(),
                new ItemShield(),
                new ItemShovel(),
                new ItemMagicRod(),
                new ItemSwitchHook(),
                new ItemBracelet(),
                new ItemBow(),
                new ItemBombs(),
                new ItemOcarina(),
                new ItemBigSword(),
                new ItemBoomerang(),
                new ItemSeedSatchel(),
                new ItemSeedShooter(),
                new ItemSlingshot(),

                // Key items:
                new ItemWallet(),
                new ItemMembersCard(),
                new ItemMagicPotion(),
                new ItemEssenceSeed(),

                // Essesnces:
                new ItemEssence1(),
                new ItemEssence2(),
                new ItemEssence3(),
                new ItemEssence4(),
                new ItemEssence5(),
                new ItemEssence6(),
                new ItemEssence7(),
                new ItemEssence8()
            );

            // Add key items.
            inventory.AddItems(false,
                new ItemFlippers());
        }
Exemplo n.º 10
0
        //-----------------------------------------------------------------------------
        // Methods
        //-----------------------------------------------------------------------------
        // Start a new game.
        public void StartGame()
        {
            roomTicks = 0;

            roomTicks = 0;

            // Setup the player beforehand so certain classes such as the HUD can reference it
            player = new Player();

            inventory						= new Inventory(this);
            menuWeapons						= new MenuWeapons(gameManager);
            menuSecondaryItems				= new MenuSecondaryItems(gameManager);
            menuEssences					= new MenuEssences(gameManager);
            menuWeapons.PreviousMenu		= menuEssences;
            menuWeapons.NextMenu			= menuSecondaryItems;
            menuSecondaryItems.PreviousMenu	= menuWeapons;
            menuSecondaryItems.NextMenu		= menuEssences;
            menuEssences.PreviousMenu		= menuSecondaryItems;
            menuEssences.NextMenu			= menuWeapons;

            GameData.LoadInventory(inventory, true);

            inventory.ObtainAmmo("ammo_scent_seeds");
            //inventory.ObtainAmmo("ammo_pegasus_seeds");
            //inventory.ObtainAmmo("ammo_gale_seeds");
            inventory.ObtainAmmo("ammo_mystery_seeds");

            hud = new HUD(this);
            hud.DynamicHealth = player.Health;

            rewardManager = new RewardManager(this);

            GameData.LoadRewards(rewardManager);

            // Create the room control.
            roomControl = new RoomControl();
            gameManager.PushGameState(roomControl);

            // Create the test world.

            // Load the world.
            //WorldFile worldFile = new WorldFile();
            //world = worldFile.Load("Content/Worlds/temp_world.zwd");

            // Begin the room state.
            if (gameManager.LaunchParameters.Length > 0) {
                WorldFile worldFile = new WorldFile();
                world = worldFile.Load(gameManager.LaunchParameters[0]);
                if (gameManager.LaunchParameters.Length > 1 && gameManager.LaunchParameters[1] == "-test") {
                    int startLevel = Int32.Parse(gameManager.LaunchParameters[2]);
                    int startRoomX = Int32.Parse(gameManager.LaunchParameters[3]);
                    int startRoomY = Int32.Parse(gameManager.LaunchParameters[4]);
                    int startPlayerX = Int32.Parse(gameManager.LaunchParameters[5]);
                    int startPlayerY = Int32.Parse(gameManager.LaunchParameters[6]);

                    player.Position = new Point2I(startPlayerX, startPlayerY) * GameSettings.TILE_SIZE + new Point2I(8, 16);
                    roomControl.BeginRoom(world.Levels[startLevel].Rooms[startRoomX, startRoomY]);
                }
                else {
                    player.Position = world.StartTileLocation * GameSettings.TILE_SIZE + new Point2I(8, 16);
                    roomControl.BeginRoom(world.StartRoom);
                }
            }
            else {
                world = GameDebug.CreateTestWorld();
                player.Position = world.StartTileLocation * GameSettings.TILE_SIZE + new Point2I(8, 16);
                roomControl.BeginRoom(world.StartRoom);
            }
            roomStateStack = new RoomStateStack(new RoomStateNormal());
            roomStateStack.Begin(this);

            AudioSystem.MasterVolume = 0.06f;
        }