Spaceball camera and perspective fixes + Karate Man animated background

This commit is contained in:
Starpelly
2021-12-30 07:17:22 -05:00
parent 5cbb182797
commit a52e883f3a
14 changed files with 322 additions and 75 deletions

View File

@ -91,17 +91,19 @@ namespace RhythmHeavenMania
{
new GameAction("shoot", delegate { Spaceball.instance.Shoot(currentBeat, false, currentType); }, true ),
new GameAction("shootHigh", delegate { Spaceball.instance.Shoot(currentBeat, true, currentType); }, true ),
new GameAction("costume", delegate { Spaceball.instance.Costume(currentType); }, true ),
new GameAction("alien", delegate { Spaceball.instance.alien.Show(currentBeat); }, true ),
new GameAction("costume", delegate { Spaceball.instance.Costume(currentType); } ),
new GameAction("alien", delegate { Spaceball.instance.alien.Show(currentBeat); } ),
// new GameAction("cameraZoom", delegate { Spaceball.instance.CameraZoom(currentBeat, currentLength, currentValA); } ),
}),
new MiniGame("karateman", "F6C135", new List<GameAction>()
{
new GameAction("bop", delegate { KarateMan.instance.Bop(); }, true ),
new GameAction("bop", delegate { KarateMan.instance.Bop(); } ),
new GameAction("pot", delegate { KarateMan.instance.Shoot(currentBeat, 0); }, true ),
new GameAction("bulb", delegate { KarateMan.instance.Shoot(currentBeat, 1); }, true ),
new GameAction("rock", delegate { KarateMan.instance.Shoot(currentBeat, 2); }, true ),
// new GameAction("cameraZoom", delegate { Spaceball.instance.CameraZoom(currentBeat, currentLength, currentValA); } ),
new GameAction("ball", delegate { KarateMan.instance.Shoot(currentBeat, 3); }, true ),
new GameAction("bgfxOn", delegate { KarateMan.instance.BGFXOn(); } ),
new GameAction("bgfxOff", delegate { KarateMan.instance.BGFXOff(); }),
})
};

View File

@ -75,6 +75,8 @@ namespace RhythmHeavenMania
{
if (Beatmap.entities.Count < 1)
return;
if (!Conductor.instance.musicSource.isPlaying)
return;
if (Input.GetKeyDown(KeyCode.A))
{

View File

@ -43,7 +43,7 @@ namespace RhythmHeavenMania.Games.KarateMan
{
Pot p = EligibleHits[currentHitInList].gameObject.GetComponent<Pot>();
if (p.type == 2)
if (p.type == 2 || p.type == 3)
{
punchLeft = false;
}

View File

@ -15,11 +15,51 @@ namespace RhythmHeavenMania.Games.KarateMan
public Sprite[] ObjectSprites;
public List<BGSpriteC> BGSprites;
public SpriteRenderer BGSprite;
private bool bgEnabled;
private int newBeat;
[System.Serializable]
public class BGSpriteC
{
public List<Sprite> Sprites;
}
private void Awake()
{
instance = this;
}
private void Update()
{
if (bgEnabled)
{
if (Conductor.instance.songPositionInBeats > newBeat)
{
if (newBeat % 2 == 0)
BGSprite.sprite = BGSprites[0].Sprites[1];
else
BGSprite.sprite = BGSprites[0].Sprites[2];
newBeat++;
}
}
}
public void BGFXOn()
{
bgEnabled = true;
newBeat = Mathf.RoundToInt(Conductor.instance.songPositionInBeats);
}
public void BGFXOff()
{
bgEnabled = false;
BGSprite.sprite = BGSprites[0].Sprites[0];
}
public void Shoot(float beat, int type)
{
GameObject pot = Instantiate(Pot);
@ -48,6 +88,10 @@ namespace RhythmHeavenMania.Games.KarateMan
Jukebox.PlayOneShotGame("karateman/objectOut");
p.hitSnd = "karateman/rockHit";
break;
case 3:
Jukebox.PlayOneShotGame("karateman/objectOut");
p.hitSnd = "karateman/soccerHit";
break;
}
}

View File

@ -51,7 +51,7 @@ namespace RhythmHeavenMania.Games.Spaceball
private void Start()
{
UpdateCameraZoom();
allCameraEvents = EventCaller.GetAllInGameManagerList("spaceball", new string[] { "cameraZoom" });
}
private void Update()
@ -85,7 +85,9 @@ namespace RhythmHeavenMania.Games.Spaceball
else
{
if (currentZoomCamLength <= 0)
{
GameManager.instance.GameCamera.transform.localPosition = new Vector3(0, 0, currentZoomCamDistance);
}
else
{
float newPosZ = Mathf.Lerp(lastCamDistance, currentZoomCamDistance, normalizedBeat);
@ -96,8 +98,6 @@ namespace RhythmHeavenMania.Games.Spaceball
private void UpdateCameraZoom()
{
allCameraEvents = EventCaller.GetAllInGameManagerList("spaceball", new string[] { "cameraZoom" });
if (allCameraEvents.Count == 0)
currentZoomCamDistance = -10;
@ -106,7 +106,12 @@ namespace RhythmHeavenMania.Games.Spaceball
if (currentZoomIndex - 1 >= 0)
lastCamDistance = allCameraEvents[currentZoomIndex - 1].valA * -1;
else
lastCamDistance = allCameraEvents[0].valA * -1;
{
if (currentZoomIndex == 0)
lastCamDistance = -10;
else
lastCamDistance = allCameraEvents[0].valA * -1;
}
currentZoomCamBeat = allCameraEvents[currentZoomIndex].beat;
currentZoomCamLength = allCameraEvents[currentZoomIndex].length;

View File

@ -63,8 +63,8 @@ namespace RhythmHeavenMania.Games.Spaceball
if (EligibleHits[currentHitInList].perfect)
{
Jukebox.PlayOneShotGame("spaceball/hit");
EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>().Holder.transform.DOLocalMove(new Vector3(Random.Range(25, 60), 0, -600), 7f).SetEase(Ease.Linear);
EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>().Holder.transform.GetChild(0).gameObject.AddComponent<Rotate>().rotateSpeed = -95;
EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>().Holder.transform.DOLocalMove(new Vector3(Random.Range(5, 18), 0, -600), 4f).SetEase(Ease.Linear);
EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>().Holder.transform.GetChild(0).gameObject.AddComponent<Rotate>().rotateSpeed = -245;
EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>().enabled = false;
EligibleHits[currentHitInList].gameObject.GetComponent<Animator>().enabled = false;