mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 13:07:40 +02:00
Misc. Fixes and Additions (#440)
* Ringside fixes * Clappy Trio bop logic fix * Quiz show answer reaction fix * prequel background begone! * You can now hide the alien in spaceball * Fixed lightning toss jank * btsds recolor, need to add lights next * Btsds lights and recolor * fixed sweat particle rendering over reporter * Asset bundles accomodation
This commit is contained in:
@ -32,18 +32,36 @@ namespace HeavenStudio.Games.Loaders
|
||||
},
|
||||
new GameAction("play piano", "Play Note")
|
||||
{
|
||||
function = delegate { BuiltToScaleDS.instance.PlayPiano(eventCaller.currentEntity.beat, eventCaller.currentEntity.length, eventCaller.currentEntity["type"]); },
|
||||
resizable = true,
|
||||
parameters = new List<Param>()
|
||||
function = delegate { BuiltToScaleDS.instance.PlayPiano(eventCaller.currentEntity.beat, eventCaller.currentEntity.length, eventCaller.currentEntity["type"]); },
|
||||
resizable = true,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("type", new EntityTypes.Integer(-24, 24, 0), "Semitones", "The number of semitones up or down this note should be pitched")
|
||||
},
|
||||
},
|
||||
},
|
||||
new List<string>() {"ntr", "normal"},
|
||||
"ntrassembly", "en",
|
||||
new List<string>() {}
|
||||
);
|
||||
new GameAction("color", "Color Palette")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; BuiltToScaleDS.instance.UpdateMappingColors(e["object"], e["shooter"], e["bg"]); },
|
||||
defaultLength = 0.5f,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("object", Color.white, "Object Color"),
|
||||
new Param("shooter", Color.white, "Shooter Color"),
|
||||
new Param("bg", new Color(0, 1, 0, 1), "Environment Color")
|
||||
}
|
||||
},
|
||||
new GameAction("lights", "Lights")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; BuiltToScaleDS.instance.Lights(e.beat, e.length, e["auto"], e["light"] && !e["auto"]); },
|
||||
defaultLength = 4f,
|
||||
resizable = true,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("auto", true, "Lights (Auto)", "Should the lights auto light?"),
|
||||
new Param("light", false, "Lights", "Should the lights light?")
|
||||
}
|
||||
}
|
||||
}, new List<string>() { "ntr", "normal" }, "ntrassembly", "en", new List<string>() { });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -62,6 +80,7 @@ namespace HeavenStudio.Games
|
||||
|
||||
[Header("References")]
|
||||
[SerializeField] SkinnedMeshRenderer environmentRenderer;
|
||||
[SerializeField] SkinnedMeshRenderer elevatorRenderer;
|
||||
public GameObject flyingRodBase;
|
||||
public GameObject movingBlocksBase;
|
||||
public GameObject hitPartsBase;
|
||||
@ -71,27 +90,87 @@ namespace HeavenStudio.Games
|
||||
public Animator shooterAnim;
|
||||
public Animator elevatorAnim;
|
||||
|
||||
[SerializeField] private Material shooterMaterial;
|
||||
[SerializeField] private Material objectMaterial;
|
||||
[SerializeField] private Material gridPlaneMaterial;
|
||||
private Material elevatorMaterial;
|
||||
private Material[] gridMaterials;
|
||||
private Material[] firstPatternLights;
|
||||
private Material[] secondPatternLights;
|
||||
|
||||
[Header("Properties")]
|
||||
[SerializeField] float beltSpeed = 1f;
|
||||
|
||||
private Material beltMaterial;
|
||||
private Material[] environmentMaterials;
|
||||
private Material[] elevatorMaterials;
|
||||
private float currentBeltOffset;
|
||||
private bool lighting = false;
|
||||
private bool autoLight = false;
|
||||
private bool firstLight = true;
|
||||
|
||||
[NonSerialized] public bool shootingThisFrame;
|
||||
[NonSerialized] public bool lastShotOut = false;
|
||||
private static Color currentObjectColor = Color.white;
|
||||
private static Color currentShooterColor = Color.white;
|
||||
private static Color currentEnvironmentColor = new Color(0, 1, 0, 1);
|
||||
|
||||
public static BuiltToScaleDS instance;
|
||||
|
||||
private GameEvent lightBeat = new GameEvent();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
|
||||
environmentMaterials = environmentRenderer.materials;
|
||||
elevatorMaterials = elevatorRenderer.materials;
|
||||
beltMaterial = Instantiate(environmentMaterials[8]);
|
||||
environmentMaterials[8] = beltMaterial;
|
||||
elevatorMaterial = Instantiate(elevatorMaterials[3]);
|
||||
elevatorMaterials[3] = elevatorMaterial;
|
||||
gridMaterials = new Material[]
|
||||
{
|
||||
Instantiate(environmentMaterials[9]),
|
||||
Instantiate(environmentMaterials[11]),
|
||||
Instantiate(environmentMaterials[12]),
|
||||
Instantiate(environmentMaterials[13]),
|
||||
Instantiate(environmentMaterials[14]),
|
||||
};
|
||||
environmentMaterials[9] = gridMaterials[0];
|
||||
environmentMaterials[11] = gridMaterials[1];
|
||||
environmentMaterials[12] = gridMaterials[2];
|
||||
environmentMaterials[13] = gridMaterials[3];
|
||||
environmentMaterials[14] = gridMaterials[4];
|
||||
|
||||
firstPatternLights = new Material[]
|
||||
{
|
||||
Instantiate(environmentMaterials[1]),
|
||||
Instantiate(environmentMaterials[2]),
|
||||
Instantiate(environmentMaterials[4]),
|
||||
};
|
||||
environmentMaterials[1] = firstPatternLights[0];
|
||||
environmentMaterials[2] = firstPatternLights[1];
|
||||
environmentMaterials[4] = firstPatternLights[2];
|
||||
|
||||
secondPatternLights = new Material[]
|
||||
{
|
||||
Instantiate(environmentMaterials[0]),
|
||||
Instantiate(environmentMaterials[3])
|
||||
};
|
||||
environmentMaterials[0] = secondPatternLights[0];
|
||||
environmentMaterials[3] = secondPatternLights[1];
|
||||
|
||||
elevatorAnim.Play("MakeRod", 0, 1f);
|
||||
UpdateColors();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
currentObjectColor = Color.white;
|
||||
currentShooterColor = Color.white;
|
||||
currentEnvironmentColor = new Color(0, 1, 0, 1);
|
||||
UpdateColors();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
@ -101,6 +180,38 @@ namespace HeavenStudio.Games
|
||||
GameCamera.additionalFoV = cameraFoV;
|
||||
}
|
||||
|
||||
public void UpdateMappingColors(Color objectColor, Color shooterColor, Color environmentColor)
|
||||
{
|
||||
currentObjectColor = objectColor;
|
||||
currentShooterColor = shooterColor;
|
||||
currentEnvironmentColor = environmentColor;
|
||||
UpdateColors();
|
||||
}
|
||||
|
||||
private void UpdateColors()
|
||||
{
|
||||
objectMaterial.SetColor("_Color", currentObjectColor);
|
||||
shooterMaterial.SetColor("_Color", currentShooterColor);
|
||||
beltMaterial.SetColor("_Color", currentEnvironmentColor);
|
||||
gridPlaneMaterial.SetColor("_Color", currentEnvironmentColor);
|
||||
elevatorMaterial.SetColor("_Color", currentEnvironmentColor);
|
||||
foreach (var mat in gridMaterials)
|
||||
{
|
||||
mat.SetColor("_Color", currentEnvironmentColor);
|
||||
}
|
||||
if (!lighting)
|
||||
{
|
||||
foreach (var mat in firstPatternLights)
|
||||
{
|
||||
mat.SetColor("_Color", currentEnvironmentColor);
|
||||
}
|
||||
foreach (var mat in secondPatternLights)
|
||||
{
|
||||
mat.SetColor("_Color", currentEnvironmentColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<DynamicBeatmap.DynamicEntity> spawnedBlockEvents = new List<DynamicBeatmap.DynamicEntity>();
|
||||
void Update()
|
||||
{
|
||||
@ -124,9 +235,15 @@ namespace HeavenStudio.Games
|
||||
}
|
||||
}
|
||||
|
||||
if (Conductor.instance.ReportBeat(ref lightBeat.lastReportedBeat, lightBeat.startBeat % 1) && autoLight)
|
||||
{
|
||||
HandleLights();
|
||||
}
|
||||
|
||||
currentBeltOffset = (currentBeltOffset + Time.deltaTime * -beltSpeed) % 1f;
|
||||
beltMaterial.mainTextureOffset = new Vector2(0f, currentBeltOffset);
|
||||
environmentRenderer.materials = environmentMaterials;
|
||||
elevatorRenderer.materials = elevatorMaterials;
|
||||
}
|
||||
|
||||
void LateUpdate()
|
||||
@ -157,6 +274,75 @@ namespace HeavenStudio.Games
|
||||
shootingThisFrame = false;
|
||||
}
|
||||
|
||||
public void Lights(float beat, float length, bool autoLights, bool shouldLights)
|
||||
{
|
||||
autoLight = autoLights;
|
||||
lighting = autoLights || shouldLights;
|
||||
if (shouldLights)
|
||||
{
|
||||
List<BeatAction.Action> actions = new List<BeatAction.Action>();
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
actions.Add(new BeatAction.Action(beat + i, delegate { HandleLights(); }));
|
||||
}
|
||||
if (!autoLights)
|
||||
{
|
||||
lighting = false;
|
||||
actions.Add(new BeatAction.Action(beat + length, delegate
|
||||
{
|
||||
foreach (var lightMat in firstPatternLights)
|
||||
{
|
||||
lightMat.DOColor(currentEnvironmentColor, 0.2f);
|
||||
}
|
||||
foreach (var lightMat in secondPatternLights)
|
||||
{
|
||||
lightMat.DOColor(currentEnvironmentColor, 0.2f);
|
||||
}
|
||||
}));
|
||||
}
|
||||
BeatAction.New(instance.gameObject, actions);
|
||||
}
|
||||
if (!autoLights && !shouldLights)
|
||||
{
|
||||
lighting = false;
|
||||
foreach (var lightMat in firstPatternLights)
|
||||
{
|
||||
lightMat.DOColor(currentEnvironmentColor, 0.2f);
|
||||
}
|
||||
foreach (var lightMat in secondPatternLights)
|
||||
{
|
||||
lightMat.DOColor(currentEnvironmentColor, 0.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleLights()
|
||||
{
|
||||
if (firstLight)
|
||||
{
|
||||
foreach (var lightMat in firstPatternLights)
|
||||
{
|
||||
lightMat.DOColor(Color.white, 0.2f);
|
||||
}
|
||||
foreach (var lightMat in secondPatternLights)
|
||||
{
|
||||
lightMat.DOColor(currentEnvironmentColor, 0.2f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var lightMat in firstPatternLights)
|
||||
{
|
||||
lightMat.DOColor(currentEnvironmentColor, 0.2f);
|
||||
}
|
||||
foreach (var lightMat in secondPatternLights)
|
||||
{
|
||||
lightMat.DOColor(Color.white, 0.2f);
|
||||
}
|
||||
}
|
||||
firstLight = !firstLight;
|
||||
}
|
||||
|
||||
public void SpawnBlocks(float beat, float length)
|
||||
{
|
||||
var newBlocks = GameObject.Instantiate(movingBlocksBase, blocksHolder).GetComponent<Blocks>();
|
||||
|
Reference in New Issue
Block a user