default color override

This commit is contained in:
playinful 2024-05-19 14:41:41 -04:00
parent 07ccfd7bfa
commit 4db005abcd
3 changed files with 55 additions and 4 deletions

View file

@ -98,6 +98,14 @@ MonoBehaviour:
Angler: {fileID: 1182995623549289263}
LakeScenePrefab: {fileID: 7031810916068253247, guid: 85290dc3ea9c9e241b6da3b302a5da7c, type: 3}
LakeSceneHolder: {fileID: 4634833702056322427}
_TopColors:
- {r: 0.70980394, g: 0.8705883, b: 0.8705883, a: 1}
- {r: 0.70980394, g: 0.8745099, b: 0.6784314, a: 1}
- {r: 0.8705883, g: 0.8705883, b: 0.6784314, a: 1}
_BottomColors:
- {r: 0.4666667, g: 0.7372549, b: 0.8196079, a: 1}
- {r: 0.3529412, g: 0.7137255, b: 0.48235297, a: 1}
- {r: 0.70980394, g: 0.627451, b: 0.41960788, a: 1}
AnglerTransform: {fileID: 4349535315128336147}
_StickyCanvas: {fileID: 2247341267177786474}
--- !u!1 &1618518225377962056

View file

@ -92,8 +92,27 @@ namespace HeavenStudio.Games.Loaders
new Param.CollapseParam((x, _) => (bool)x, new string[] { "fishDensity" })
}),
new Param("fishDensity", new EntityTypes.Float(0f, 1f, 1f), "Fish Density", "Set the density for the fish in the school."),
new Param("crossfade", true, "Crossfade", "Set whether or not this scene will fade smoothly into the next one."),
},
},
new GameAction("color", "Default Color Override")
{
function = delegate { var e = eventCaller.currentEntity; CatchOfTheDay.Instance.DefaultColorOverride(e["override"], e["topColorA"], e["bottomColorA"], e["topColorB"], e["bottomColorB"], e["topColorC"], e["bottomColorC"]); },
defaultLength = 0.5f,
parameters = new List<Param>()
{
new Param("override", true, "Override", "Set whether or not to use a set of overridden colors.", new List<Param.CollapseParam>()
{
new Param.CollapseParam((x, _) => (bool)x, new string[] { "topColorA", "bottomColorA", "topColorB", "bottomColorB", "topColorC", "bottomColorC" })
}),
new Param("topColorA", new Color(0.7098039f, 0.8705882f, 0.8705882f), "Top Color A", "Set the top color for Layout A."),
new Param("bottomColorA", new Color(0.4666667f, 0.7372549f, 0.8196079f), "Bottom Color A", "Set the bottom color for Layout A."),
new Param("topColorB", new Color(0.7098039f, 0.8745099f, 0.6784314f), "Top Color B", "Set the top color for Layout B."),
new Param("bottomColorB", new Color(0.3529412f, 0.7137255f, 0.482353f), "Bottom Color B", "Set the bottom color for Layout B."),
new Param("topColorC", new Color(0.8705883f, 0.8705883f, 0.6784314f), "Top Color C", "Set the top color for Layout C."),
new Param("bottomColorC", new Color(0.7098039f, 0.627451f, 0.4196079f), "Bottom Color C", "Set the bottom color for Layout C."),
}
},
new GameAction("moveAngler", "Move Angler")
{
function = delegate { var e = eventCaller.currentEntity; CatchOfTheDay.Instance.SetAnglerMovement(e); },
@ -171,6 +190,13 @@ namespace HeavenStudio.Games
[SerializeField] GameObject LakeScenePrefab;
[SerializeField] Transform LakeSceneHolder;
[SerializeField] Color[] _TopColors;
[SerializeField] Color[] _BottomColors;
private Color[] TopColorOverrides = null;
private Color[] BottomColorOverrides = null;
public Color[] TopColors => TopColorOverrides ?? _TopColors;
public Color[] BottomColors => BottomColorOverrides ?? _BottomColors;
public int? LastLayout;
public Dictionary<RiqEntity, LakeScene> ActiveLakes = new();
@ -278,6 +304,11 @@ namespace HeavenStudio.Games
SetAnglerMovement(e);
}
if (EventCaller.GetAllInGameManagerList("catchOfTheDay", new string[] { "color" }).LastOrDefault(e => e.beat <= beat) is RiqEntity colorEntity)
{
DefaultColorOverride(colorEntity["override"], colorEntity["topColorA"], colorEntity["bottomColorA"], colorEntity["topColorB"], colorEntity["bottomColorB"], colorEntity["topColorC"], colorEntity["bottomColorC"]);
}
// get active fishes
foreach (RiqEntity e in GetActiveFishes(beat))
{
@ -388,6 +419,19 @@ namespace HeavenStudio.Games
}
_StickyCanvas.Sticky = (bool)e["sticky"];
}
public void DefaultColorOverride(bool doOverride, Color topColorA, Color bottomColorA, Color topColorB, Color bottomColorB, Color topColorC, Color bottomColorC)
{
if (doOverride)
{
TopColorOverrides = new Color[] { topColorA, topColorB, topColorC };
BottomColorOverrides = new Color[] { bottomColorA, bottomColorB, bottomColorC };
}
else
{
TopColorOverrides = null;
BottomColorOverrides = null;
}
}
public void DoPickAnim()
{
@ -477,6 +521,8 @@ namespace HeavenStudio.Games
RiqEntity nextFish = GetNextFish(beat);
if (nextFish is not null)
{
if (EventCaller.GetAllInGameManagerList("catchOfTheDay", new string[] { "color" }).LastOrDefault(e => e.beat >= beat && e.beat <= nextFish.beat) is RiqEntity e)
DefaultColorOverride(e["override"], e["topColorA"], e["bottomColorA"], e["topColorB"], e["bottomColorB"], e["topColorC"], e["bottomColorC"]);
NewLake(nextFish);
return true;
}

View file

@ -24,9 +24,6 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
[SerializeField] public GameObject[] SchoolFishes;
[SerializeField] public ParticleSystem[] Bubbles;
[SerializeField] Color[] TopColors;
[SerializeField] Color[] BottomColors;
public RiqEntity Entity;
public PlayerActionEvent ReelAction;
public CatchOfTheDay Minigame;
@ -162,7 +159,7 @@ namespace HeavenStudio.Games.Scripts_CatchOfTheDay
}
else
{
SetBGColors(TopColors[layout], BottomColors[layout]);
SetBGColors(minigame.TopColors[layout], minigame.BottomColors[layout]);
}
float xOffset = UnityEngine.Random.Range(-0.5f, 0.5f);