mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 18:37:38 +02:00
Karate Man Additions Part 1 (#559)
* starting out with adding so many things * voiceless kicks and combos (that one was easy) * queuing objects/specials * starting on cutting out the voice -i was using MultiSound.Delete() but i found it very inconsistent and janky so im switching to a check of the next block and if it should cut out the voice * got rid of basically all of the static variables in favor of checking the last color blocks -also means that the bg and object colors getting held over between remixes shouldn't happen anymore * removed all of the super backwards compatibility -im almost certain these blocks are only available in .tengoku files though, so nobody should have any issues * convert karateman to karateMan * conversion stuff start * voice cutting fully works and is consistent now color conversion isn't working, but ill fix it eventually background color isn't working rn either, and moving to the new system has caused a lot of errors * it compiles now this Background Appearance block got hands ‼️ working on converting everything to the new bg color system this will be so annoying to build a RiqUpdater for. * bunch of small stuff i got this done while i was at a cabin * bg still broken :( * unconvert karateman from karateMan, bg finally works well. bg ALMOST finally works i'll be doing the fx stuff after, and ill combine it with the flow block * bg nearly done * i just might give up on bg compatibility i tried for like an hour and a half to convert it but i couldn't. minenice might be able to but idk. * background + lightbulb stuffs * FINALLY got old bg blocks updating + better bulb sfx store the keys of the objects in the dictionary that i want to remove, create the properties, then remove all of the objects using the keys. bulbs use a method that lets any sfx go through for the throw and hit, which means custom lightbulb cues 😃 moved all queuing into one list, then a foreach checks the datamodel of each riqentity in the list camera bug fixed (call update in awake and start) recolorable barrels lol * and with that, it's finished! added backwards compatibility for bg fx and fixed the particles (oops i forgot to assign them in the inspector * fixed a bug the warning would not go away if you dragged the playback bar behind a warning cuz it wasn't checking for the beginning of a warning block * oops forgot to remove a debug log
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -18,7 +18,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
public Color BombGlowTint;
|
||||
double bombGlowStart = double.MinValue;
|
||||
float bombGlowLength = 0f;
|
||||
float bombGlowIntensity;
|
||||
float bombGlowIntensity = 0f;
|
||||
const float bombGlowRatio = 1f;
|
||||
|
||||
double lastPunchTime = double.MinValue;
|
||||
@ -46,10 +46,6 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
Conductor.instance.GetPositionFromBeat(lastChargeTime, 2.75f) <= 0.25f || inNuriLock; } }
|
||||
public bool inNuriLock { get { return (Conductor.instance.songPositionInBeatsAsDouble >= noNuriJabTime && Conductor.instance.songPositionInBeatsAsDouble < noNuriJabTime + 1f); } }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
@ -68,7 +64,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
bombGlowLength = 0f;
|
||||
}
|
||||
}
|
||||
UpdateShadowColour();
|
||||
UpdateJoeColour();
|
||||
|
||||
if (canEmote && wantFace >= 0)
|
||||
{
|
||||
@ -334,15 +330,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
canEmote = false;
|
||||
}
|
||||
|
||||
public void UpdateShadowColour()
|
||||
public void UpdateJoeColour()
|
||||
{
|
||||
foreach (var shadow in Shadows)
|
||||
{
|
||||
shadow.color = KarateMan.instance.GetShadowColor();
|
||||
}
|
||||
|
||||
Color mainCol = KarateMan.BodyColor;
|
||||
Color highlightCol = KarateMan.HighlightColor;
|
||||
Color mainCol = KarateMan.instance.BodyColor;
|
||||
Color highlightCol = KarateMan.instance.HighlightColor;
|
||||
|
||||
if (bombGlowIntensity > 0)
|
||||
{
|
||||
@ -383,6 +374,7 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
|
||||
public void RemoveBombGlow(double beat, float length = 0.5f)
|
||||
{
|
||||
if (double.IsNaN(bombGlowIntensity)) return;
|
||||
bombGlowStart = beat;
|
||||
bombGlowLength = length;
|
||||
bombGlowIntensity = 0f;
|
||||
|
@ -2,6 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Jukebox;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
@ -53,10 +54,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
float scaleFactor = 0f;
|
||||
//clear all children of the holder
|
||||
if (NoriHolder != null)
|
||||
{
|
||||
foreach (Transform child in NoriHolder)
|
||||
{
|
||||
if (NoriHolder != null) {
|
||||
foreach (Transform child in NoriHolder) {
|
||||
Destroy(child.gameObject);
|
||||
}
|
||||
}
|
||||
@ -81,9 +80,20 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
NoriManiaInk01.SetActive(false);
|
||||
playedJust = false;
|
||||
|
||||
inputsToSwitch = KarateMan.CountHitsToEnd(fromBeat);
|
||||
inputsToSwitch = CountHitsToEnd(fromBeat);
|
||||
break;
|
||||
default:
|
||||
case (int) KarateMan.NoriMode.ManiaHorizontal:
|
||||
MaxNori = 10;
|
||||
Nori = Mathf.Clamp(startingNori, 0, MaxNori);
|
||||
scaleFactor = ScaleFactorMania;
|
||||
NoriHolder = NoriHolderMania01;
|
||||
NoriManiaInk00.SetActive(true);
|
||||
NoriManiaInk01.SetActive(true);
|
||||
playedJust = false;
|
||||
|
||||
inputsToSwitch = CountHitsToEnd(fromBeat);
|
||||
break;
|
||||
default: //KarateMan.NoriMode.None
|
||||
MaxNori = 0;
|
||||
Nori = 0;
|
||||
NoriManiaInk00.SetActive(false);
|
||||
@ -238,21 +248,14 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
Material mat = NoriHeartMaterials[i];
|
||||
if (noriMode == (int) KarateMan.NoriMode.Tengoku)
|
||||
{
|
||||
if (Nori == MaxNori)
|
||||
{
|
||||
if (Nori == MaxNori) {
|
||||
mat.SetColor("_ColorAlpha", NoriColorsTengoku[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (KarateMan.instance.NoriPerformance < 0.6)
|
||||
mat.SetColor("_ColorAlpha", NoriColorsTengoku[0]);
|
||||
else
|
||||
{
|
||||
if (i < 2)
|
||||
mat.SetColor("_ColorAlpha", NoriColorsTengoku[1]);
|
||||
else
|
||||
mat.SetColor("_ColorAlpha", NoriColorsTengoku[2]);
|
||||
}
|
||||
} else if (KarateMan.instance.NoriPerformance < 0.6) {
|
||||
mat.SetColor("_ColorAlpha", NoriColorsTengoku[0]);
|
||||
} else if (i < 2) {
|
||||
mat.SetColor("_ColorAlpha", NoriColorsTengoku[1]);
|
||||
} else {
|
||||
mat.SetColor("_ColorAlpha", NoriColorsTengoku[2]);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -270,12 +273,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
flashPeriod = Mathf.Sin(cond.songPositionInBeats * Mathf.PI);
|
||||
if (KarateMan.instance.NoriPerformance < 0.6)
|
||||
c = NoriColorsMania[0];
|
||||
else
|
||||
{
|
||||
if (i < MaxNori - 2)
|
||||
c = NoriColorsMania[1];
|
||||
else
|
||||
c = NoriColorsMania[2];
|
||||
else if (i < MaxNori - 2) {
|
||||
c = NoriColorsMania[1];
|
||||
} else {
|
||||
c = NoriColorsMania[2];
|
||||
}
|
||||
c *= (flashPeriod * 0.5f) + 1f;
|
||||
}
|
||||
@ -289,15 +290,51 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
Transform target = GameCamera.instance.transform;
|
||||
|
||||
Vector3 displacement = target.forward * CameraOffset;
|
||||
Vector3 displacement = target.forward * CameraOffset;
|
||||
transform.position = target.position + displacement;
|
||||
transform.rotation = target.rotation;
|
||||
|
||||
UpdateHeartColours();
|
||||
|
||||
float inkRot = (Conductor.instance.songPositionInBeats/ 8f) % 1f;
|
||||
float inkRot = (Conductor.instance.songPositionInBeats / 8f) % 1f;
|
||||
NoriManiaInk00.transform.localRotation = Quaternion.Euler(0, 0, inkRot * 360);
|
||||
NoriManiaInk01.transform.localRotation = Quaternion.Euler(0, 0, inkRot * 360);
|
||||
}
|
||||
public int CountHitsToEnd(double fromBeat)
|
||||
{
|
||||
List<RiqEntity> allHits = EventCaller.GetAllInGameManagerList("karateman", new string[] { "hit", "bulb", "kick", "combo" });
|
||||
List<RiqEntity> allEnds = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame", "end" });
|
||||
|
||||
allHits.Sort((x, y) => x.beat.CompareTo(y.beat));
|
||||
allEnds.Sort((x, y) => x.beat.CompareTo(y.beat));
|
||||
double endBeat = double.MaxValue;
|
||||
|
||||
//get the beat of the closest end event
|
||||
foreach (var end in allEnds) {
|
||||
if (end.beat > fromBeat) {
|
||||
endBeat = end.beat;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//count each hit event beginning from our current beat to the beat of the closest game switch or end
|
||||
int count = 0;
|
||||
string type;
|
||||
for (int i = 0; i < allHits.Count; i++)
|
||||
{
|
||||
RiqEntity h = allHits[i];
|
||||
if (h.beat >= fromBeat)
|
||||
{
|
||||
if (h.beat < endBeat) {
|
||||
//kicks and combos count for 2 hits
|
||||
type = h.datamodel.Split('/')[1];
|
||||
count += (type is "kick" or "combo") ? 2 : 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
@ -13,10 +13,12 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
public double startBeat;
|
||||
public ItemType type;
|
||||
public int path = 1;
|
||||
public string hitSfxOverride;
|
||||
|
||||
public GameObject Shadow;
|
||||
public GameObject ShadowInstance;
|
||||
SpriteRenderer shadowRenderer;
|
||||
private GameObject ShadowInstance;
|
||||
private SpriteRenderer shadowRenderer;
|
||||
|
||||
|
||||
//hit effects
|
||||
public GameObject HitMark;
|
||||
@ -28,12 +30,13 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
|
||||
[SerializeField] SpriteRenderer[] cellRenderers;
|
||||
Material[] cellMaterials;
|
||||
public Color[] ItemBarrelMap;
|
||||
[SerializeField] Color[] ItemAlienMap;
|
||||
[SerializeField] Color[] ItemBombMap;
|
||||
[SerializeField] Color[] ItemBarrelMap;
|
||||
[SerializeField] Color[] ItemCookingLidMap;
|
||||
|
||||
public bool KickBarrelContent = false;
|
||||
public bool ShouldGlow = false;
|
||||
public int OnHitExpression = (int) KarateMan.KarateManFaces.Normal;
|
||||
|
||||
public int comboId = -1;
|
||||
@ -128,13 +131,13 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
case ItemType.Alien:
|
||||
alpha = ItemAlienMap[0];
|
||||
bravo = ItemAlienMap[1];
|
||||
delta = KarateMan.ItemColor;
|
||||
delta = KarateMan.instance.ItemColor;
|
||||
break;
|
||||
case ItemType.Bomb:
|
||||
case ItemType.KickBomb:
|
||||
alpha = ItemBombMap[0];
|
||||
bravo = ItemBombMap[1];
|
||||
delta = KarateMan.ItemColor;
|
||||
delta = KarateMan.instance.ItemColor;
|
||||
break;
|
||||
case ItemType.KickBarrel:
|
||||
case ItemType.ComboBarrel:
|
||||
@ -146,12 +149,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
case ItemType.CookingLid:
|
||||
alpha = ItemCookingLidMap[0];
|
||||
bravo = ItemCookingLidMap[1];
|
||||
delta = KarateMan.ItemColor;
|
||||
delta = KarateMan.instance.ItemColor;
|
||||
break;
|
||||
default:
|
||||
alpha = KarateMan.ItemColor;
|
||||
bravo = KarateMan.ItemColor;
|
||||
delta = KarateMan.ItemColor;
|
||||
alpha = bravo = delta = KarateMan.instance.ItemColor;
|
||||
break;
|
||||
}
|
||||
for (int i = 0; i < cellRenderers.Length; i++) {
|
||||
@ -254,9 +255,11 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
|
||||
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-360f * Time.deltaTime) + UnityEngine.Random.Range(0f, 360f));
|
||||
|
||||
ShadowInstance = GameObject.Instantiate(Shadow, KarateMan.instance.ItemHolder);
|
||||
|
||||
|
||||
ShadowInstance = Instantiate(Shadow, KarateMan.instance.ItemHolder);
|
||||
shadowRenderer = ShadowInstance.GetComponent<SpriteRenderer>();
|
||||
shadowRenderer.color = KarateMan.instance.GetShadowColor();
|
||||
shadowRenderer.color = KarateMan.instance.Joe.Shadows[0].color;
|
||||
ShadowInstance.SetActive(true);
|
||||
ShadowInstance.transform.position = new Vector3(transform.position.x, floorHeight - 0.5f, transform.position.z);
|
||||
}
|
||||
@ -289,8 +292,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
ParticleSystem p = Instantiate(HitParticles[7], transform.position, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
|
||||
GameObject.Destroy(ShadowInstance.gameObject);
|
||||
GameObject.Destroy(gameObject);
|
||||
Destroy(ShadowInstance.gameObject);
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
else if (prog >= 2f || (ItemKickable() && prog >= 1f)) {
|
||||
@ -299,8 +302,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
ParticleSystem p = Instantiate(HitParticles[7], ItemCurves[6].GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
}
|
||||
GameObject.Destroy(ShadowInstance.gameObject);
|
||||
GameObject.Destroy(gameObject);
|
||||
Destroy(ShadowInstance.gameObject);
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
else if (CurrentCurve == null && prog < 1f - ItemSlipRt[path]) {
|
||||
@ -318,8 +321,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
ParticleSystem p = Instantiate(HitParticles[7], CurrentCurve.GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
|
||||
GameObject.Destroy(ShadowInstance.gameObject);
|
||||
GameObject.Destroy(gameObject);
|
||||
Destroy(ShadowInstance.gameObject);
|
||||
Destroy(gameObject);
|
||||
|
||||
SoundByte.PlayOneShotGame("karateman/bombBreak", volume: 0.25f);
|
||||
return;
|
||||
@ -334,8 +337,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
else if (type == ItemType.KickBall && cond.songPositionInBeatsAsDouble < startBeat + curveTargetBeat + 1f)
|
||||
return;
|
||||
|
||||
GameObject.Destroy(ShadowInstance.gameObject);
|
||||
GameObject.Destroy(gameObject);
|
||||
Destroy(ShadowInstance.gameObject);
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@ -359,8 +362,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
ParticleSystem p = Instantiate(HitParticles[7], CurrentCurve.GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
|
||||
GameObject.Destroy(ShadowInstance.gameObject);
|
||||
GameObject.Destroy(gameObject);
|
||||
Destroy(ShadowInstance.gameObject);
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
else if (cond.songPositionInBeatsAsDouble >= startBeat + Mathf.Max(2f, curveTargetBeat) || (ItemKickable() && prog >= 1f) || CurrentCurve == null) {
|
||||
@ -369,8 +372,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
ParticleSystem p = Instantiate(HitParticles[7], ItemCurves[8].GetPoint(1f), Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
}
|
||||
GameObject.Destroy(ShadowInstance.gameObject);
|
||||
GameObject.Destroy(gameObject);
|
||||
Destroy(ShadowInstance.gameObject);
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@ -396,14 +399,14 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
ParticleSystem p = Instantiate(HitParticles[7], pos, Quaternion.identity, KarateMan.instance.ItemHolder);
|
||||
p.Play();
|
||||
|
||||
GameObject.Destroy(ShadowInstance.gameObject);
|
||||
GameObject.Destroy(gameObject);
|
||||
Destroy(ShadowInstance.gameObject);
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
else if (cond.songPositionInBeatsAsDouble >= startBeat + 3f)
|
||||
{
|
||||
GameObject.Destroy(ShadowInstance.gameObject);
|
||||
GameObject.Destroy(gameObject);
|
||||
Destroy(ShadowInstance.gameObject);
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
if (prog <= 1f)
|
||||
@ -414,13 +417,13 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
break;
|
||||
}
|
||||
ShadowInstance.transform.position = new Vector3(transform.position.x, floorHeight - 0.5f, transform.position.z);
|
||||
shadowRenderer.color = KarateMan.instance.GetShadowColor();
|
||||
shadowRenderer.color = KarateMan.instance.Joe.Shadows[0].color;
|
||||
SetColourMapping();
|
||||
}
|
||||
|
||||
void CreateHitMark(bool useLocalPos = false)
|
||||
{
|
||||
GameObject hitMark = GameObject.Instantiate(HitMark, KarateMan.instance.ItemHolder);
|
||||
GameObject hitMark = Instantiate(HitMark, KarateMan.instance.ItemHolder);
|
||||
if (useLocalPos)
|
||||
hitMark.transform.localPosition = transform.position;
|
||||
else
|
||||
@ -439,8 +442,8 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
{
|
||||
case ItemType.Bulb:
|
||||
CurrentCurve = ItemCurves[straight ? 1 : 0];
|
||||
curveTargetBeat = straight ? 1f : 1.5f;;
|
||||
SoundByte.PlayOneShotGame("karateman/lightbulbHit", forcePlay: true);
|
||||
curveTargetBeat = straight ? 1f : 1.5f;
|
||||
SoundByte.PlayOneShotGame(hitSfxOverride ?? "karateman/lightbulbHit", forcePlay: true);
|
||||
p = Instantiate(HitParticles[5], HitPosition[1].position, Quaternion.Euler(0, 0, UnityEngine.Random.Range(0f, 360f)), game.ItemHolder);
|
||||
|
||||
if (effectTint.a == 0)
|
||||
@ -565,11 +568,10 @@ namespace HeavenStudio.Games.Scripts_KarateMan
|
||||
p.Play();
|
||||
break;
|
||||
case ItemType.KickBarrel:
|
||||
if (KickBarrelContent)
|
||||
if (KickBarrelContent) {
|
||||
game.CreateItemInstance(startBeat + 1f, "Item03", OnHitExpression, ItemType.KickBall);
|
||||
else
|
||||
{
|
||||
game.Joe.ApplyBombGlow();
|
||||
} else {
|
||||
if (ShouldGlow) game.Joe.ApplyBombGlow();
|
||||
game.CreateItemInstance(startBeat + 1f, "Item04", OnHitExpression, ItemType.KickBomb);
|
||||
}
|
||||
SoundByte.PlayOneShotGame("karateman/barrelBreak", forcePlay: true);
|
||||
|
Reference in New Issue
Block a user