public override void _Ready() { _alchemy = GetParent().GetParent <Alchemy>(); _mortarSplash = GetParent().GetNode <Particles2D>("Crush/MortarSplash"); _pestle = GetParent().GetNode <Pestle>("Pestle"); _potionCircle = GetParent().GetNode <PotionCircle>("Crush/PotionCircle"); _potionProgress = GetParent().GetNode <TextureProgress>("Crush/PotionProgress"); _mortarSplashBurst = GD.Load <PackedScene>("res://particle/MortarSplashBurst.tscn"); _pestle.Connect("body_entered", this, nameof(_OnPestleBodyEntered)); }
public override void _Ready() { GD.Randomize(); // Get references to all the nodes we need to manipulate _mortar = GetNode <Mortar>("MortarPestle/Mortar"); _potionCircle = GetNode <PotionCircle>("MortarPestle/Crush/PotionCircle"); _potionReagentsBox = GetNode <VBoxContainer>("MortarPestle/PickReagents/PotionReagentsBox"); _helpDialog = GetNode <AcceptDialog>("HelpDialog"); _proceedToCrush = GetNode <Button>("MortarPestle/PickReagents/ProceedToCrush"); _tween = GetNode <Tween>("MortarPestle/PickReagents/Tween"); _inventory = GetNode <Inventory>("MortarPestle/PickReagents/Inventory"); _inventory.SetSize(4, 4); _inventory.DrawPosition = new Vector2(324f, 16f); _inventory.CanDeselect = false; _itemTooltip = GetNode <ItemTooltip>("MortarPestle/PickReagents/ItemTooltip"); _debugOverlay = GetNode <DebugOverlay>("DebugOverlay"); // Load assets needed _itemBtnBg = GD.Load <Texture>("res://textures/item_slot.png"); _singleItemSlot = GD.Load <Texture>("res://textures/single_item_slot.png"); _smallFont = GD.Load <DynamicFont>("res://font/small_font.tres"); // Signal connections GetNode <TouchScreenButton>("HelpButton").Connect("released", this, nameof(DisplayHelpPopup)); _proceedToCrush.Connect("pressed", this, nameof(ProceedToCrushPressed)); _tween.Connect("tween_all_completed", this, nameof(TweenAllCompleted)); _inventory.Connect("ItemSlotSelected", this, nameof(InventorySlotSelected)); GetNode <Button>("MortarPestle/PickReagents/AddToPotion").Connect("pressed", this, nameof(ItemButtonReleased)); // Adding items to simulate an inventory _itemList.AddRange(new Item.ItemStack[] { new Item.ItemStack(Items.BRIMSTONE, 1), new Item.ItemStack(Items.FLY_AGARIC, 3), new Item.ItemStack(Items.ELDERBERRIES, 5), new Item.ItemStack(Items.ORPIMENT, 1), new Item.ItemStack(Items.HOLLY_BERRIES, 3) }); _inventory.UpdateSlots(_itemList); // Tracking stuff for debug _debugOverlay.TrackProperty(nameof(_mortarPestleStage), this, "MortarPestleStage"); _debugOverlay.TrackProperty(nameof(_mortar.CurrentParticleColour), _mortar, "Splash Colour"); }