public override void _Ready() { Signals.UpgradesChanged += CheckVisibility; var bg = GetNode <ColorRect>("Background"); Speed = bg.GetNode <InfoPanel>("Speed"); Tank = bg.GetNode <InfoPanel>("Tank"); Regen = bg.GetNode <InfoPanel>("Regen"); Inventory = bg.GetNode <InfoPanel>("Inventory"); Speed.SetPanelType(InfoPanel.UpgradeType.ROVER, Enums.RoverUpgradeType.SPEED); Tank.SetPanelType(InfoPanel.UpgradeType.ROVER, Enums.RoverUpgradeType.TANK); Regen.SetPanelType(InfoPanel.UpgradeType.ROVER, Enums.RoverUpgradeType.REGEN); Inventory.SetPanelType(InfoPanel.UpgradeType.ROVER, Enums.RoverUpgradeType.INVENTORY); Signals.PublishUpgradesChangedEvent(); }
/// <summary> /// Apply a Regen effect to the target /// </summary> /// <param name="target">target GameObject.</param> /// <param name="lengthTime">length time.</param> /// <param name="tickTime">tick time.</param> /// <param name="healingPerTick">healing per tick.</param> public void regenApplyingSystem(GameObject target, float lengthTime, float tickTime, int healingPerTick) { Regen hot = target.GetComponent <Regen>(); if (hot == null) { hot = target.AddComponent <Regen>(); } else { hot.stopRegen(); } // A tenth of a second is added to the duration to ensure the last bit of a damage tick // can go off. If the last tick goes off as the DoT destroys itself, it doesn't seem // to apply. hot.setDuration(lengthTime + 0.1f); hot.setTickCooldown(tickTime); hot.setHealingPerTick(healingPerTick); hot.startRegen(); }