//Useful methods public String getVitalName(VitalType vt) { switch (vt) { case VitalType.Health: return(HEALTH_POINTS_NAME); case VitalType.BloodToxicity: return(BLOOD_TOXICITY_NAME); case VitalType.DiastolicBP: return(DIASTOLIC_NAME); case VitalType.SystolicBP: return(SYSTOLIC_NAME); case VitalType.O2Level: return(O2_NAME); case VitalType.Temperature: return(TEMPURATURE_NAME); case VitalType.HeartRate: return(HEART_BEAT_NAME); default: return("Update Util.getVitalName to have new vitals ;)"); } }
public ConsoleColor getVitalColor(VitalType vt) { switch (vt) { case VitalType.Health: return(HEALTH_POINTS_COLOR); case VitalType.BloodToxicity: return(BLOOD_TOXICITY_COLOR); case VitalType.DiastolicBP: return(DIASTOLIC_COLOR); case VitalType.SystolicBP: return(SYSTOLIC_COLOR); case VitalType.O2Level: return(O2_COLOR); case VitalType.Temperature: return(TEMPURATURE_COLOR); case VitalType.HeartRate: return(HEART_BEAT_COLOR); default: throw new Exception("No vital found in Utilities.getVitalColor(VitalType vt)"); } }
void OnVitalChanged(VitalType vt, int change) { if (vt == VitalType.Health) { GlobalEvents.Raise(GlobalEvent.PopupRequested, this.transform.position + (Vector3.up * 2), (change == 0 ? "<color=yellow>" : (change < 0 ? "<color=red>" : "<color=green>")) + change + "</color>"); if (data.GetVital(vt).current <= 0) { OnDeath(); return; } } else if (vt == VitalType.Corruption) { GlobalEvents.Raise(GlobalEvent.PopupRequested, this.transform.position + (Vector3.up * 2), "<color=purple>Corruption:</color> " + (change == 0 ? "<color=yellow>" : (change < 0 ? "<color=red>" : "<color=green>")) + change + "</color>"); if (data.GetVital(vt).current == data.GetVital(vt).GetMax()) { OnDeath(); return; } } else if (vt == VitalType.Stamina) { UpdateMovementMap(); UpdateActorStatus(); } GlobalEvents.Raise(GlobalEvent.ActorVitalChanged, this, vt); }
public Vital(VitalType type, Func <int> getMax, Func <string> getTooltip) { this.type = type; _getMax = getMax; _getTooltip = getTooltip; this.current = type == VitalType.Corruption ? 0 : _getMax(); }
void OnVitalChange(VitalType v, float current) { OnVitalChanged?.Invoke(v, current); //hook in audio here if (v == VitalType.HullPoints && current <= 0f) { OnShipDestroyed(); } }
void OnVitalChanged(VitalType vt, float currentInPercent) { if (vt == VitalType.HullPoints) { _hull.fillAmount = currentInPercent; } else if (vt == VitalType.ShieldPoints) { _shield.fillAmount = currentInPercent; } }
/* * private void writeEffect(Effect e){ * int writtenLen = 0; * writtenLen += writeVitalNameInColor(e.VitalType); * * string changeStr = ""; * if( e.ChangePerTurn.Peek() > 0){ * changeStr = " +" + e.ChangePerTurn.Peek(); * } * else if(e.ChangePerTurn.Peek() < 0){ * changeStr = " -" + e.ChangePerTurn.Peek(); * } * else{ * changeStr = " did not change"; * } * Console.Write(changeStr); * writtenLen += changeStr.Length; * * writeBlanksNewLine( writtenLen ,5 ); * * } */ private int writeVitalNameInColor(VitalType vt) { int writtenLen = 0; ConsoleColor color = Game.Util.getVitalColor(vt); String str = Game.Util.getVitalName(vt); writtenLen += str.Length; writeStrInColor(str, color); return(writtenLen); }
void OnVitalChanged(VitalType v, float current) { if (v == VitalType.ShieldPoints) { _shield.fillAmount = _ship.GetVital(v).inPercent; } else if (v == VitalType.HullPoints) { _hull.fillAmount = _ship.GetVital(v).inPercent; } }
public Vital(VitalType type, int startingValue, int min, int max, int normalMin, int normalMax, ConsoleColor forgroundColor, string unit) { this.type = type; this.min = min; this.max = max; this.normalMax = normalMax; this.normalMin = normalMin; this.textColor = forgroundColor; this.unit = unit; //set last for reasons setCurrentValue(startingValue); //this.currentValue = startingValue; turnChangeStatus = ""; }
public static string ToStringFormat(VitalType type) { switch (type) { case VitalType.Health: return("<color=red>Health</color>"); case VitalType.Corruption: return("<color=purple>Corruption</color>"); case VitalType.Stamina: return("<color=green>Stamina</color>"); default: return("Vital N/A"); } }
public static Color ToColor(VitalType type) { switch (type) { case VitalType.Health: return(Color.red); case VitalType.Corruption: return(new Color(.5f, 0f, .5f)); case VitalType.Stamina: return(Color.green); default: return(Color.white); } }
public static string Format(VitalType type) { switch (type) { case VitalType.MovementSpeed: return("Movement Speed"); case VitalType.RotationSpeed: return("Rotational Speed"); case VitalType.ScanRadius: return("Scan Range"); case VitalType.ScanRate: return("Scan Rate"); case VitalType.HullPoints: return("Hull Hitpoints"); case VitalType.ShieldPoints: return("Shield Hitpoints"); case VitalType.GasStorage: return("Gas Storage"); case VitalType.OreStorage: return("Ore Storage"); case VitalType.FuelStorage: return("Fuel Storage"); case VitalType.GoodsStorage: return("Goods Storage"); default: return("No format specified for " + type.ToString()); } }
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 void applyVitalEffectNow(VitalType vt, int ammount) { foreach (VitalType minVt in this.MinorVitalMap.Keys) { if (vt == minVt) { this.MinorVitalMap[vt].CurrentValue += ammount; setDeltaHealth(); return; } } foreach (VitalType majVt in this.MajorVitalMap.Keys) { if (vt == majVt) { this.MajorVitalMap[vt].CurrentValue += ammount; setDeltaHealth(); return; } } //if we don't find the vitral in Minor/Major throw this soft error. throw new Exception("Need to update the Enums map to add the new vital"); }
public VitalNameType(VitalType vitalType) { this.type = vitalType; this.name = System.Enum.GetName(typeof(VitalType), vitalType); this.hash = name.GetHashCode(); }
public VitalCommand(Actor actor, VitalType type, int amount) : base(actor) { _type = type; _amount = amount; }
public Vital(float maxValue, VitalType type) { _maxValue = maxValue; _currentValue = maxValue; _type = type; }
public VitalModifier(int value, VitalType type) { _value = value; _type = type; }
void OnActorVitalChanged(Actor a, VitalType vt) { UpdateVital(_items[a].transform.Find(vt.ToString().ToLower()), a.data.GetVital(vt).current, a.data.GetVital(vt).GetMax(), Vital.ToColor(vt)); }
/// <summary> /// Initializes a new instance of the <see cref="VitalAnnouncement"/> struct. /// </summary> /// <param name="vitalType">The type of vital.</param> public VitalAnnouncement(VitalType vitalType) { VitalType = vitalType; }
public Effect(VitalType vt, Queue <int> changePerTurn, string flavorText) { this.VitalType = vt; this.ChangePerTurn = changePerTurn; this.FlavorText = flavorText; }
public VitalNameType(string name) { this.type = (VitalType)NameTypeUtils.GetVitalTypeForName(name, enumNames); this.name = name; this.hash = name.GetHashCode(); }
public float GetVital(VitalType vt) { return(_vitals[(int)vt]); }
public VitalModifier(VitalType type, float value, ModifierMode mode, ModifierTarget target) : base(value, mode, target) { _type = type; }