Changed craft times for all items,buildings, researches and added research that can change game stats/effects.
This commit is contained in:
@@ -25,13 +25,20 @@ public class Research
|
||||
elapsedResearchTime += delta;
|
||||
if (elapsedResearchTime >= data.CraftTime)
|
||||
{
|
||||
state = ResearchState.RESEARCHED;
|
||||
Complete();
|
||||
return ResearchResult.FINISHED;
|
||||
}
|
||||
|
||||
return ResearchResult.RESEARCHING;
|
||||
}
|
||||
|
||||
public void Complete()
|
||||
{
|
||||
if (state == ResearchState.RESEARCHED) return;
|
||||
|
||||
state = ResearchState.RESEARCHED;
|
||||
GameData.robotStats.Apply(data.Effects);
|
||||
}
|
||||
|
||||
public static string GetReadableName(string input)
|
||||
{
|
||||
string noUnderscore = input.Replace("_", " ").ToLower();
|
||||
|
||||
@@ -18,6 +18,9 @@ public class ResearchData
|
||||
[JsonPropertyName("texture")]
|
||||
public string Texture { get; set; }
|
||||
|
||||
[JsonPropertyName("effects")]
|
||||
public List<ResearchEffect> Effects { get; set; }
|
||||
|
||||
public string GetReadableName()
|
||||
{
|
||||
string noUnderscore = Id.Replace("_", " ").ToLower();
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class ResearchEffect
|
||||
{
|
||||
[JsonPropertyName("stat")]
|
||||
public string Stat { get; set; }
|
||||
|
||||
[JsonPropertyName("value")]
|
||||
public float Value { get; set; }
|
||||
|
||||
public string GetDisplayText()
|
||||
{
|
||||
return Stat switch
|
||||
{
|
||||
"robot_speed_bonus" => $"Robot speed +{Value * 100f:0}%",
|
||||
"robot_energy_use_reduction" => $"Robot energy use -{Value * 100f:0}%",
|
||||
"robot_heat_gain_reduction" => $"Robot heat gain -{Value * 100f:0}%",
|
||||
"robot_cooling_bonus" => $"Robot cooling +{Value * 100f:0}%",
|
||||
"robot_maintenance_loss_reduction" => $"Robot maintenance loss -{Value * 100f:0}%",
|
||||
"robot_minimum_efficiency_bonus" => $"Damaged robot efficiency +{Value * 100f:0}%",
|
||||
_ => Stat
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://c6k1b1inavgyj
|
||||
@@ -3,5 +3,6 @@ public enum ResearchState
|
||||
UNDEFINED,
|
||||
RESEARCHED,
|
||||
AVAILABLE,
|
||||
LOCKED
|
||||
LOCKED,
|
||||
RESEARCHING
|
||||
}
|
||||
Reference in New Issue
Block a user