void OnScanned() { _uiItem.transform.Find("text").GetComponent <Text>().text = "[" + _entity.name + "]:\n" + _entity.count.ToString("0.##") + " units of " + FleetVital.Format(_entity.type); LogManager.getInstance.AddEntry(_entity.count.ToString("0.##") + " units of " + FleetVital.Format(_entity.type) + " has been scanned."); }
void OnDiscovered() { _isDiscovered = true; _uiItem.transform.Find("text").GetComponent <Text>().text = "[" + _entity.name + "]:\n" + "??? units of " + FleetVital.Format(_entity.type); _uiItem.transform.Find("icon").GetComponent <Image>().sprite = ModelDB.GetResourceIcon(_entity.type); _uiItem.transform.Find("icon").GetComponent <Image>().color = FleetVital.Color(_entity.type); LogManager.getInstance.AddEntry("??? units of " + FleetVital.Format(_entity.type) + " has been discovered."); }
public override void Interact() { if (PlayerData.fleet.GetVital(FleetVitalType.ProcessedFuel).current >= _jumpCost) { PlayerData.fleet.GetVital(FleetVitalType.ProcessedFuel).Update(-_jumpCost); RuntimeData.SetSystem(_system); SceneManager.LoadSceneAsync("Overworld"); } else { LogManager.getInstance.AddEntry("Not enough " + FleetVital.Format(FleetVitalType.ProcessedFuel) + "! " + _jumpCost + " units required!", 15f, EntryType.Combat); } }
public string GetTooltip(bool includeReason = true) { string s = ""; s += "<color=" + (base.value > 0 ? "green" : "red") + ">" + (base.mode == ModifierMode.Percentage ? base.value * 100f : base.value).ToString("+0.##;-0.##") + "</color>"; s += (base.mode == ModifierMode.Percentage ? "%" : "") + " "; s += FleetVital.Format(_type) + (_setting == ModifierSetting.Repeating ? " daily" : ""); if (includeReason) { s += " due to " + _reason; } return(s); }
void InitializeResources() { //fuel CreateResourceItem(FleetVitalType.ProcessedFuel, FleetVital.Format(FleetVitalType.ProcessedFuel) + " is crucial for your fleets ability to travel to other systems.\n" + "It is created by processing " + FleetVital.Format(FleetVitalType.NebulaGas) + " using a <color=yellow>Refinement Module</color> on a specialized ship\n" + "or at a <color=yellow>Orbital Refinery</color>."); //ammo CreateResourceItem(FleetVitalType.Ammunition, FleetVital.Format(FleetVitalType.Ammunition) + " is crucial for your fleets operational capabilities.\n" + "Low supplies of " + FleetVital.Format(FleetVitalType.Ammunition) + " might cause negative penalties.\n" + FleetVital.Format(FleetVitalType.Ammunition) + " can be manufactured by processing " + FleetVital.Format(FleetVitalType.Veldspar) + " using a <color=yellow>Manufacturing Module</color> on a specialized ship\n" + "or at a <color=yellow>Orbital Manufacturing Plant</color>."); //civilian supplies CreateResourceItem(FleetVitalType.CivilianSupplies, FleetVital.Format(FleetVitalType.CivilianSupplies) + " represents everyday goods consumed by the varying crews of your ships.\n" + "Low supplies of " + FleetVital.Format(FleetVitalType.CivilianSupplies) + " might cause ships to desert.\n" + FleetVital.Format(FleetVitalType.CivilianSupplies) + " can be manufactured by processing " + FleetVital.Format(FleetVitalType.Tritanite) + " using a <color=yellow>Manufacturing Module</color> on a specialized ship\n" + "or at a <color=yellow>Orbital Manufacturing Plant</color>."); CreateSeparator(); //nebula gas CreateResourceItem(FleetVitalType.NebulaGas, FleetVital.Format(FleetVitalType.NebulaGas) + " is a highly volatile gas used to create " + FleetVital.Format(FleetVitalType.ProcessedFuel) + "."); //veldspar CreateResourceItem(FleetVitalType.Veldspar, FleetVital.Format(FleetVitalType.Veldspar) + " is the most common mineral in the galaxy.\n" + "It is commonly used to manufacture " + FleetVital.Format(FleetVitalType.Ammunition) + "."); //tritanite CreateResourceItem(FleetVitalType.Tritanite, FleetVital.Format(FleetVitalType.Tritanite) + " is a highly versatile mineral.\n" + "It is commonly used to manufacture " + FleetVital.Format(FleetVitalType.CivilianSupplies) + "."); CreateSeparator(); CreateResourceItem(FleetVitalType.Movement, FleetVital.Format(FleetVitalType.Movement) + " determines how far your fleet can move."); }
protected string GetResourceString() { string s = ""; s += "Local resources:\n\n"; int turns = OverworldManager.turnCount; int threshold = DifficultyUtils.Multiply(RuntimeData.save.data.difficulty, 2); bool infoAvailable = turns > threshold; if (!infoAvailable) { s += "Data will become available in " + (threshold - turns) + " days.\n\n"; } s += FleetVital.Format(FleetVitalType.NebulaGas) + ": " + (infoAvailable ? (base.resourceDensities[0] * 100f).ToString("0.##") : "?") + "%\n"; s += FleetVital.Format(FleetVitalType.Veldspar) + ": " + (infoAvailable ? (base.resourceDensities[1] * 100f).ToString("0.##") : "?") + "%\n"; s += FleetVital.Format(FleetVitalType.Tritanite) + ": " + (infoAvailable ? (base.resourceDensities[2] * 100f).ToString("0.##") : "?") + "%\n"; return(s); }
public static string FormatTooltip(VitalType type) { switch (type) { case VitalType.MovementSpeed: return("Forward movement speed."); case VitalType.RotationSpeed: return("Rotational movement speed."); case VitalType.ScanRadius: return("Range of proximity scan."); case VitalType.ScanRate: return("Update rate for proximity scan."); case VitalType.HullPoints: return("Hull hitpoints, only damaged after shield reaches zero."); case VitalType.ShieldPoints: return("Shield hitpoints."); case VitalType.GasStorage: return("Contributes to the fleet maximum cap of " + FleetVital.Format(FleetVitalType.NebulaGas) + "."); case VitalType.OreStorage: return("Contributes to the fleet maximum cap of " + FleetVital.Format(FleetVitalType.Veldspar) + " and " + FleetVital.Format(FleetVitalType.Tritanite) + "."); case VitalType.FuelStorage: return("Contributes to the fleet maximum cap of " + FleetVital.Format(FleetVitalType.ProcessedFuel) + "."); case VitalType.GoodsStorage: return("Contributes to the fleet maximum cap of " + FleetVital.Format(FleetVitalType.Ammunition) + " and " + FleetVital.Format(FleetVitalType.CivilianSupplies) + "."); default: return("No tooltipformat for " + type.ToString()); } }
public static string ProcessFlags(string original) { //FORMATVITAL_VITAL foreach (string word in original.Split(new char[] { ' ', '.', ',', '!', '?', '\n' })) { if (word.Contains("FORMATVITAL")) { original = Regex.Replace(original, word, FleetVital.Format((FleetVitalType)Enum.Parse(typeof(FleetVitalType), word.Split('_')[1], true))); } else if (word.Contains("LISTPLAYERFLEET")) { //LISTPLAYERFLEET //generate list of player fleet string fleet = ""; for (int i = 0; i < PlayerData.fleet.ships.Count; i++) { fleet += "the <i><color=yellow>" + PlayerData.fleet.ships[i].name + "</color></i>" + (i == PlayerData.fleet.ships.Count - 1 ? "" : (i == PlayerData.fleet.ships.Count - 2 ? " and " : ", ")); } original = Regex.Replace(original, @"\bLISTPLAYERFLEET\b", fleet); } else if (word.Contains("LISTFACTIONMODIFIERS")) { ////LISTFACTIONMODIFIERS //string modifiers = ""; //for (int i = 0; i < RuntimeData.save.data.player.modifiers.Length; i++) // modifiers += RuntimeData.save.data.player.modifiers[i].GetTooltip() + "\n"; //original = Regex.Replace(original, @"\bLISTFACTIONMODIFIERS\b", modifiers); } } return(original); }
public void RemoveModifier(FleetVitalModifier fvm) { _modifiers.Remove(fvm); LogManager.getInstance.AddEntry("<i><color=yellow>" + _name + "</color></i> has lost a modifier: [" + fvm.value + " " + FleetVital.Format(fvm.type) + " due to " + fvm.reason + ".]"); OnModifierRemoved?.Invoke(fvm); }
public void AddModifier(FleetVitalModifier fvm) { _modifiers.Add(fvm); LogManager.getInstance.AddEntry("<i><color=yellow>" + _name + "</color></i> has gained a modifier: [" + fvm.value + " " + FleetVital.Format(fvm.type) + " due to " + fvm.reason + " for " + fvm.duration + (fvm.isInfinite ? "∞" : " days") + ".]"); OnModifierAdded?.Invoke(fvm); }
void OnCountChanged(float count) { _uiItem.transform.Find("text").GetComponent <Text>().text = "[" + _entity.name + "]:\n" + _entity.count.ToString("0.##") + " units of " + FleetVital.Format(_entity.type); }
IEnumerator ExtractResources(ResourceEntity target) { float extractionRate = _extractionAmount / _duration; float sum = 0f; float t = 0f; GameObject vfx = Object.Instantiate(_vfxPrefab, base.owner.transform); GameObject visualTarget = target.GetVisualTarget(); LineRenderer lr = vfx.GetComponent <LineRenderer>(); lr.positionCount = 2; while (t <= _duration) { if (target == null || Vector3.Distance(base.owner.transform.position, target.transform.position) > _range) { LogManager.getInstance.AddEntry("[" + base.owner.name + "]: Mining operation aborted. " + sum + " units of " + FleetVital.Format(target.type) + " acquired."); Object.Destroy(vfx); yield break; } t += Time.deltaTime; sum += target.Extract(extractionRate * Time.deltaTime); PlayerData.fleet.GetVital(target.type).Update(target.Extract(extractionRate * Time.deltaTime)); lr.SetPosition(0, base.owner.transform.position); lr.SetPosition(1, visualTarget.transform.position); yield return(null); } LogManager.getInstance.AddEntry("[" + base.owner.name + "]: Mining operation completed. " + sum + " units of " + FleetVital.Format(target.type) + " acquired."); Object.Destroy(vfx); }
public override string GetTooltip() { bool primitiveDataAvailable = OverworldManager.turnCount > DifficultyUtils.Multiply(RuntimeData.save.data.difficulty, 5); bool advancedDataAvailable = OverworldManager.turnCount > DifficultyUtils.Multiply(RuntimeData.save.data.difficulty, 8); string s = ""; s += "Leads to [" + _system.star.name + "]:"; s += "\n"; s += primitiveDataAvailable ? "" : "Primitive data will become available in " + (DifficultyUtils.Multiply(RuntimeData.save.data.difficulty, 5) - OverworldManager.turnCount) + " turn(s).\n"; s += advancedDataAvailable ? "" : "Advanced data will become available in " + (DifficultyUtils.Multiply(RuntimeData.save.data.difficulty, 8) - OverworldManager.turnCount) + " turn(s).\n"; s += "\n"; s += (primitiveDataAvailable ? _system.planets.Count.ToString() : "?") + " planet(s).\n"; s += (primitiveDataAvailable ? _system.stargates.Count.ToString() : "?") + " stargate(s).\n"; s += (primitiveDataAvailable ? _system.structures.Count.ToString() : "?") + " structure(s).\n"; s += (primitiveDataAvailable ? _system.wormholes.Count.ToString() : "?") + " wormhole(s).\n"; s += "\n"; if (advancedDataAvailable) { if (_system.structures.Count > 0) { s += "[Structures]:\n"; for (int i = 0; i < _system.structures.Count; i++) { s += _system.structures[i].name + ".\n"; } s += "\n"; } s += "? fleets.\n"; s += "\n"; } s += "<color=" + (PlayerData.fleet.GetVital(FleetVitalType.ProcessedFuel).current >= _jumpCost ? "white" : "red") + ">Jump cost: " + _jumpCost + "</color> " + FleetVital.Format(FleetVitalType.ProcessedFuel); s += "\n\n" + base.GetDistanceTooltip(); return(s); }
public void Tick() { for (int i = 0; i < _conversions.Length; i++) { if (PlayerData.fleet.GetVital(_conversions[i].start).current > 0f) { float amount; if (_conversions[i].maxConversionPerTurn > PlayerData.fleet.GetVital(_conversions[i].start).current) { amount = PlayerData.fleet.GetVital(_conversions[i].start).current; } else { amount = _conversions[i].maxConversionPerTurn; } PlayerData.fleet.GetVital(_conversions[i].start).Update(-amount); PlayerData.fleet.GetVital(_conversions[i].end).Update(amount * _conversions[i].rate); LogManager.getInstance.AddEntry(amount.ToString("0.##") + " units of " + FleetVital.Format(_conversions[i].start) + " has been converted to " + (amount * _conversions[i].rate).ToString("0.##") + " units of " + FleetVital.Format(_conversions[i].end) + "."); } } }