public static Color Color(FleetVitalType type) { switch (type) { case FleetVitalType.ProcessedFuel: return(new Color(.5f, 0f, 1f)); case FleetVitalType.Ammunition: return(new Color(1f, .5f, 0f)); case FleetVitalType.CivilianSupplies: return(new Color(.5f, .5f, 0f)); case FleetVitalType.NebulaGas: return(new Color(0f, 1f, 1f)); case FleetVitalType.Veldspar: return(new Color(1f, 0f, 0f)); case FleetVitalType.Tritanite: return(new Color(1f, 0f, 1f)); case FleetVitalType.Movement: return(new Color(.5f, .5f, 1f)); case FleetVitalType.Detection: return(new Color(1f, 0f, 0f)); default: return(new Color(1f, 1f, 1f)); } }
public ResourceConversion(float maxConversionPerTurn, float rate, FleetVitalType start, FleetVitalType end) { _maxConversionPerTurn = maxConversionPerTurn; _rate = rate; _start = start; _end = end; }
public FleetVitalModifier(string reason, int duration, float value, FleetVitalType type, ModifierSetting setting, ModifierMode mode, ModifierTarget target) : base(value, mode, target) { _reason = reason; _duration = duration; _type = type; _setting = setting; isInfinite = duration < 0; }
public FleetVital(FleetVitalType type, float max) { _max = max; _current = max; _changePerTurn = 0f; _staticCurrentModSum = 0f; _staticMaxModSum = 0f; _type = type; }
public static string Format(FleetVitalType type) { string f = "<color=#" + ColorUtility.ToHtmlStringRGB(Color(type)) + ">"; switch (type) { case FleetVitalType.ProcessedFuel: f += "Processed Fuel"; break; case FleetVitalType.Ammunition: f += "Ammunition"; break; case FleetVitalType.CivilianSupplies: f += "Civilian Supplies"; break; case FleetVitalType.NebulaGas: f += "Nebula Gas"; break; case FleetVitalType.Veldspar: f += "Veldspar"; break; case FleetVitalType.Tritanite: f += "Tritanite"; break; case FleetVitalType.Movement: f += "Movement Range"; break; case FleetVitalType.Detection: f += "Detection Range"; break; default: break; } f += "</color>"; return(f); }
void CreateResourceItem(FleetVitalType type, string tooltip) { FleetVital v = PlayerData.fleet.GetVital(type); GameObject g = Instantiate(_toolbarResourceItem, _toolbar); g.GetComponent <GenericTooltipHandler>().Initialize( () => TooltipManager.getInstance.OpenTooltip(tooltip + "\n\n" + PlayerData.fleet.GetVital(type).GetTooltipExtended(), Input.mousePosition), null, null, null, () => TooltipManager.getInstance.CloseTooltip()); g.transform.Find("icon").GetComponent <Image>().sprite = ModelDB.GetResourceIcon(type); g.transform.Find("icon").GetComponent <Image>().color = FleetVital.Color(type); _resourceItems.Add(g); UpdateResourceItem(v); }
void GenerateResources() { float bufferedMapSize = (LOCAL_MAP_SIZE * .9f); FleetVitalType[] resources = new FleetVitalType[] { FleetVitalType.NebulaGas, FleetVitalType.Veldspar, FleetVitalType.Tritanite }; var all = Resources.LoadAll <GameObject>("Combat/ExtractableResources/"); for (int j = 0; j < resources.Length; j++) { int count = Mathf.RoundToInt(MAX_ASTEROID_COUNT * _resourceDensities[j]); var resourceModels = all.Where(re => re.GetComponent <ResourceEntity>().type == resources[j]).ToArray(); List <GameObject> asteroids = new List <GameObject>(); for (int i = 0; i < count; i++) { Vector3 pos = new Vector3( Random.Range(-bufferedMapSize, bufferedMapSize), Random.Range(-bufferedMapSize, bufferedMapSize), Random.Range(-bufferedMapSize, bufferedMapSize)); while (asteroids.Any(a => Vector3.Distance(a.transform.position, pos) < MIN_DISTANCE_BETWEEN_ASTEROIDS)) { pos = new Vector3( Random.Range(-bufferedMapSize, bufferedMapSize), Random.Range(-bufferedMapSize, bufferedMapSize), Random.Range(-bufferedMapSize, bufferedMapSize)); } asteroids.Add( Object.Instantiate( resourceModels.RandomItem(), pos, Random.rotation, null)); } } }
public FleetVital(FleetVitalType type, float current, float max) { _max = max; if (current < 0) { _current = 0; } else if (current > max) { _current = max; } else { _current = current; } _changePerTurn = 0f; _type = type; }
public string ListModifiers(FleetVitalType type) { string s = ""; s += "[<i><color=yellow>" + _name + "</color></i>]:\n"; for (int i = 0; i < _modifiers.Count; i++) { float v = _modifiers[i].value; if (_modifiers[i].type == type) { s += "<color=" + (v == 0 ? "yellow" : v > 0 ? "green" : "red") + ">" + v.ToString("0.##") + "</color>" + (_modifiers[i].setting == ModifierSetting.Repeating ? " daily" : "") + ", due to: " + _modifiers[i].reason + ", " + (_modifiers[i].isInfinite ? "∞\n" : _modifiers[i].duration + " days.\n"); } } for (int i = 0; i < _utilities.Length; i++) { if (_utilities[i] is ResourceConversionUtility) { ResourceConversionUtility rcu = ((ResourceConversionUtility)_utilities[i]); for (int j = 0; j < rcu.conversions.Length; j++) { if (rcu.conversions[j].start == type) { s += "<color=red>-" + rcu.conversions[j].maxConversionPerTurn.ToString("0.##") + "</color> daily (if possible), due to: [<color=yellow>" + rcu.name + "</color>].\n"; } else if (rcu.conversions[j].end == type) { s += "<color=green>+" + (rcu.conversions[j].maxConversionPerTurn * rcu.conversions[j].rate).ToString("0.##") + "</color> daily (if possible), due to: [<color=yellow>" + rcu.name + "</color>].\n"; } } } } return(s); }
public FleetVital GetVital(FleetVitalType type) { return(_vitals[(int)type]); }
public static Sprite GetResourceIcon(FleetVitalType type) { return(_resourceIcons[(int)type]); }