public override void _Ready() { blockResourceLoader = GetNode(BLOCK_RESOURCE_LOADER_PATH) as ResourcePreloader; guiResourceLoader = GetNode(GUI_RESOURCE_LOADER) as ResourcePreloader; //Generate texture atlas once resource loaders initialized GenerateTextureMap(); }
public override void _Ready() { base._Ready(); this.SetNodesByDeclaredNodePaths(); CloseImmediate(); _resourcePreloader = GetNode <ResourcePreloader>("ResourcePreloader"); GameEventDispatcher.Instance.Connect(nameof(GameEventDispatcher.EventDialogueStarted), this, nameof(OnDialogueStarted)); _animationPlayer.Connect("animation_finished", this, nameof(OnAnimationFinished)); _dialogueWindow.Connect("mouse_entered", this, nameof(OnWindowMouseEntered)); }
public override void _Ready() { _questNameLabel = GetNode <Label>("QuestNameLabel"); _questStageNameLabel = GetNode <Label>("QuestStageNameLabel"); _questPromptLabel = GetNode <Label>("QuestPromptLabel"); _resourcePreloader = GetNode <ResourcePreloader>("ResourcePreloader"); _questNameLabel.Visible = false; _questPromptLabel.Visible = false; _questStageNameLabel.Visible = false; }
public override void _Ready() { Instance = this; EntitiesLayer = GetNode <YSort>("Entities"); EffectsLayer = GetNode <YSort>("Effects"); FloatersLayer = GetNode <Node>("Floaters"); Camera = GetNode <Camera2D>("Camera2D"); _resourcePreloader = GetNode <ResourcePreloader>("ResourcePreloader"); _navigation = GetNode <Navigation2D>("Navigation2D"); UpdateNavigationMesh(); }
public override void _Ready() { base._Ready(); this.SetNodesByDeclaredNodePaths(); _resourcePreloader = GetNode <ResourcePreloader>("ResourcePreloader"); CreateInventoryCells(); Visible = false; Close(); PlayerInventory.Instance.Connect(nameof(PlayerInventory.ItemUpdated), this, nameof(OnItemUpdated)); PlayerInventory.Instance.Connect(nameof(PlayerInventory.CurrencyChanged), this, nameof(OnCurrencyChanged)); _panelContainer.Connect("resized", this, nameof(OnPanelResized)); }
public override void _Ready() { GetTree().SetScreenStretch(SceneTree.StretchMode.Mode2d, SceneTree.StretchAspect.Ignore, new Vector2(1920, 1080)); OS.SetWindowMaximized(true); _graphEdit = GetNode <GraphEdit>("VBoxContainer/GraphEdit"); _resourcePreloader = GetNode <ResourcePreloader>("ResourcePreloader"); _eventSelectorDialog = GetNode <WindowDialog>("EventSelectorDialog"); _nodeSelectorDialog = GetNode <WindowDialog>("NodeSelectorDialog"); _openFileDialog = GetNode <FileDialog>("OpenFileDialog"); _saveFileDialog = GetNode <FileDialog>("SaveFileDialog"); var eventItemList = _eventSelectorDialog.GetNode <ItemList>("VBoxContainer/ItemList"); foreach (var key in GameEventDispatcher.GameEventMapping.Keys) { var evt = GameEventDispatcher.GameEventMapping[key]; eventItemList.AddItem(evt.DisplayName); } eventItemList.Connect("item_activated", this, nameof(OnQuestEventItemActivated)); var nodeItemList = _nodeSelectorDialog.GetNode <ItemList>("VBoxContainer/ItemList"); nodeItemList.AddItem(nameof(QuestStartNode)); nodeItemList.AddItem(nameof(QuestStageNode)); nodeItemList.AddItem(nameof(QuestEventNode)); nodeItemList.AddItem(nameof(QuestCompleteNode)); nodeItemList.AddItem(nameof(QuestRewardNode)); nodeItemList.Connect("item_activated", this, nameof(OnNodeSelectorSelected)); GetNode("VBoxContainer/HBoxContainer/AddNode").Connect("pressed", this, nameof(OnAddNodePressed)); GetNode("VBoxContainer/HBoxContainer/SaveButton").Connect("pressed", this, nameof(OnSaveButtonPressed)); GetNode("VBoxContainer/HBoxContainer/OpenButton").Connect("pressed", this, nameof(OnOpenButtonPressed)); _graphEdit.Connect("connection_request", this, nameof(OnConnectionRequest)); _graphEdit.Connect("disconnection_request", this, nameof(OnDisconnectRequest)); _openFileDialog.Connect("file_selected", this, nameof(OnFileSelected)); _saveFileDialog.Connect("file_selected", this, nameof(OnSaveFileSelected)); }
public override void _Ready() { itemResourceLoader = GetNode(Game.ITEM_RESOURCE_LOADER) as ResourcePreloader; // arbitrary choice: blocks are stackable var itemBlockInits = new List <Tuple <ItemID, string, string, byte> > { Tuple.Create(RED_ROCK, "Red Rock", "itemRedRock", Game.GetBlockId <RedRock>()), Tuple.Create(STONE_BLOCK, "Stone", "itemStone", Game.GetBlockId <Stone>()), Tuple.Create(ICE, "Ice", "itemIce", Game.GetBlockId <IceBlock>()), Tuple.Create(OXYGEN_BACTERIA_FOSSIL, "O2 Bacteria Fossil", "itemBacteriaFossil", Game.GetBlockId <OxygenBacteriaFossilBlock>()), Tuple.Create(NITROGEN_BACTERIA_FOSSIL, "N2 Bacteria Fossil", "itemBacteriaFossil", Game.GetBlockId <NitrogenBacteriaFossilBlock>()), Tuple.Create(CARBON_DIOXIDE_BACTERIA_FOSSIL, "CO2 Bacteria Fossil", "itemBacteriaFossil", Game.GetBlockId <CarbonDioxideBacteriaFossilBlock>()), Tuple.Create(GRASS_FOSSIL, "Grass Fossil", "itemGrassFossil", Game.GetBlockId <GrassFossilBlock>()), Tuple.Create(TREE_FOSSIL, "Tree Fossil", "itemTreeFossil", Game.GetBlockId <TreeFossilBlock>()), Tuple.Create(WHEAT_FOSSIL, "Wheat Fossil", "itemWheatFossil", Game.GetBlockId <WheatFossilBlock>()), Tuple.Create(FROG_FOSSIL, "Frog Fossil", "itemAnimalFossil", Game.GetBlockId <FrogFossilBlock>()), Tuple.Create(REGULAR_ANIMAL_FOSSIL, "Animal Fossil", "itemAnimalFossil", Game.GetBlockId <RegularAnimalFossilBlock>()), Tuple.Create(BIG_ANIMAL_FOSSIL, "Giant Fossil", "itemAnimalFossil", Game.GetBlockId <BigAnimalFossilBlock>()) }; // arbitrary choice: consumables are not stackable var itemConsumableInits = new List <Tuple <ItemID, string, string, Player.Stats, float> > { Tuple.Create(CHOCOLATE, "Chocolate", "itemChocolate", Player.Stats.FOOD, 0.2f), Tuple.Create(CAKE, "Cake", "itemCake", Player.Stats.FOOD, 0.2f), Tuple.Create(WATER, "Water", "itemWater", Player.Stats.WATER, 0.2f), Tuple.Create(MEAT, "Meat", "itemMeat", Player.Stats.FOOD, 0.4f) }; // arbitrary choice: vials are stackable var itemVialInits = new List <Tuple <ItemID, string, string> > { Tuple.Create(OXYGEN_BACTERIA_VIAL, "O2 Bacteria", "itemOxygenBacteriaVial"), Tuple.Create(NITROGEN_BACTERIA_VIAL, "N2 Bacteria", "itemNitrogenBacteriaVial"), Tuple.Create(CARBON_DIOXIDE_BACTERIA_VIAL, "CO2 Bacteria", "itemCarbonDioxideBacteriaVial") }; // arbitrary choice: plants are stackable var plantInits = new List <Tuple <ItemID, string, string, PlantType, byte, ItemID?> > { Tuple.Create(GRASS, "Grass", "itemGrass", PlantType.GRASS, Game.GetBlockId <GrassBlock>(), (ItemID?)RED_ROCK), Tuple.Create(TREE, "Tree", "itemTree", PlantType.TREE, Game.GetBlockId <TreeBlock>(), (ItemID?)null /* TODO: change to tree */), Tuple.Create(WHEAT, "Wheat", "itemWheat", PlantType.WHEAT, Game.GetBlockId <WheatBlock>(), (ItemID?)null) }; // arbitrary choice: eggs are not stackable var eggInits = new List <Tuple <ItemID, string, string, string> > { Tuple.Create(FROG_EGG, "Frog egg", "itemFrogEgg", "frog"), Tuple.Create(REGULAR_EGG, "Animal egg", "itemEgg", "animal0"), Tuple.Create(BIG_EGG, "Big animal egg", "itemBigEgg", "big") }; foreach (var data in itemBlockInits) { items[data.Item1] = new ItemBlock(data.Item1, data.Item2, GetTexture(data.Item3), data.Item4); items[data.Item1].Stackable = true; } foreach (var data in itemConsumableInits) { items[data.Item1] = new ItemConsumable(data.Item1, data.Item2, GetTexture(data.Item3), data.Item4, data.Item5); } foreach (var data in itemVialInits) { items[data.Item1] = new ItemBacteriaVial(data.Item1, data.Item2, GetTexture(data.Item3)); items[data.Item1].Stackable = true; } foreach (var data in plantInits) { items[data.Item1] = new ItemPlant(data.Item1, data.Item2, GetTexture(data.Item3), data.Item4, data.Item5, data.Item6.HasValue ? items[data.Item6.Value] : null); items[data.Item1].Stackable = true; } foreach (var data in eggInits) { items[data.Item1] = new ItemSpawnEgg(data.Item1, data.Item2, GetTexture(data.Item3), data.Item4); items[data.Item1].Stackable = true; } }
public override void _Ready() { animalResourceLoader = GetNode(Game.ANIMAL_RESOURCE_LOADER) as ResourcePreloader; presets = new List <AnimalPreset>(); // For now, hardcode presets AnimalPreset male0 = new AnimalPreset( AnimalBehaviourComponent.AnimalSex.Male, animalResourceLoader.GetResource("MaleAnimal0") as PackedScene, AnimalBehaviourComponent.AnimalDiet.Carnivore, 10, 90, "animal0", 2, 10 ); AnimalPreset female0 = new AnimalPreset( AnimalBehaviourComponent.AnimalSex.Female, animalResourceLoader.GetResource("FemaleAnimal0") as PackedScene, AnimalBehaviourComponent.AnimalDiet.Carnivore, 10, 90, "animal0", 2, 10 ); AnimalPreset maleFrog = new AnimalPreset( AnimalBehaviourComponent.AnimalSex.Male, animalResourceLoader.GetResource("MaleFrog") as PackedScene, AnimalBehaviourComponent.AnimalDiet.Herbivore, 1, 90, "frog", 1, 5 ); AnimalPreset femaleFrog = new AnimalPreset( AnimalBehaviourComponent.AnimalSex.Female, animalResourceLoader.GetResource("FemaleFrog") as PackedScene, AnimalBehaviourComponent.AnimalDiet.Herbivore, 1, 90, "frog", 1, 5 ); AnimalPreset maleBig = new AnimalPreset( AnimalBehaviourComponent.AnimalSex.Male, animalResourceLoader.GetResource("MaleBig") as PackedScene, AnimalBehaviourComponent.AnimalDiet.Omnivore, 100, 70, "big", 3, 20 ); AnimalPreset femaleBig = new AnimalPreset( AnimalBehaviourComponent.AnimalSex.Female, animalResourceLoader.GetResource("FemaleBig") as PackedScene, AnimalBehaviourComponent.AnimalDiet.Omnivore, 100, 70, "big", 3, 20 ); AnimalPreset maleFrogBD = new AnimalPreset( AnimalBehaviourComponent.AnimalSex.Male, animalResourceLoader.GetResource("MaleFrog") as PackedScene, AnimalBehaviourComponent.AnimalDiet.Herbivore, 1, 80, "frogBD" ); AnimalPreset femaleFrogBD = new AnimalPreset( AnimalBehaviourComponent.AnimalSex.Female, animalResourceLoader.GetResource("FemaleFrog") as PackedScene, AnimalBehaviourComponent.AnimalDiet.Herbivore, 1, 80, "frogBD" ); AnimalPreset male0BD = new AnimalPreset( AnimalBehaviourComponent.AnimalSex.Male, animalResourceLoader.GetResource("MaleAnimal0") as PackedScene, AnimalBehaviourComponent.AnimalDiet.Carnivore, 1, 80, "animal0BD" ); AnimalPreset female0BD = new AnimalPreset( AnimalBehaviourComponent.AnimalSex.Female, animalResourceLoader.GetResource("FemaleAnimal0") as PackedScene, AnimalBehaviourComponent.AnimalDiet.Carnivore, 1, 80, "animal0BD" ); presets.Add(male0); presets.Add(female0); presets.Add(maleFrog); presets.Add(femaleFrog); presets.Add(maleBig); presets.Add(femaleBig); presets.Add(male0BD); presets.Add(female0BD); presets.Add(maleFrogBD); presets.Add(femaleFrogBD); //Code for demos. /* * BreedingDemo(); * EatingDemo(); */ //HollisticDemo(); }
public override void _Ready() { _introLabel = GetNode <Label>("IntroductionLabel"); _container = GetNode <VBoxContainer>("VBoxContainer"); _resourcePreloader = GetNode <ResourcePreloader>("ResourcePreloader"); }
public override void _Ready() { _resourcePreloader = GetNode <ResourcePreloader>("ResourcePreloader"); QuestTracker.Instance.Connect(nameof(QuestTracker.PreQuestStarted), this, nameof(OnNewQuestStarted)); }