Roll cue platform visuals done

This commit is contained in:
Rapandrasmus 2023-06-26 13:36:45 +02:00
parent 0d81381348
commit 1d4fc52e37
3 changed files with 67 additions and 42 deletions

View file

@ -277,6 +277,7 @@ MonoBehaviour:
platform: {fileID: 8602790381015410525}
fallYan: {fileID: 142440390168805750}
fish: {fileID: 3392966659349309181}
rollPlatform: {fileID: 3096308579732643404}
--- !u!95 &4653690538679061971
Animator:
serializedVersion: 5
@ -1000,7 +1001,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4921680285842369143}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 4.4, y: 6.48, z: 0}
m_LocalPosition: {x: 4.7253, y: 6.48, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -1053,7 +1054,7 @@ SpriteRenderer:
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 1
m_Size: {x: 3.78, y: 0.43}
m_Size: {x: 4.430684, y: 0.43}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1

View file

@ -148,6 +148,7 @@ namespace HeavenStudio.Games
List<HeightEvent> heightEntityEvents = new();
[NonSerialized] public Dictionary<double, TypeEvent> platformTypes = new();
private List<double> fishBeats = new();
private List<double> rollBeats = new();
public struct TypeEvent
{
public PlatformType platformType;
@ -218,6 +219,11 @@ namespace HeavenStudio.Games
{
fishBeats.Add(fishEvent.beat);
}
List<RiqEntity> rollEvents = EventCaller.GetAllInGameManagerList("nightWalkAgb", new string[] { "roll" });
foreach (var rollEvent in rollEvents)
{
rollBeats.Add(rollEvent.beat);
}
}
private void OnDestroy()
@ -247,6 +253,11 @@ namespace HeavenStudio.Games
return fishBeats.Contains(beat);
}
public bool RollOnBeat(double beat)
{
return rollBeats.Contains(beat);
}
public int FindHeightUnitsAtBeat(double beat)
{
List<HeightEvent> tempEvents = heightEntityEvents.FindAll(e => e.beat <= beat);

View file

@ -35,11 +35,14 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
[NonSerialized] public bool stopped;
[SerializeField] private GameObject fallYan;
[SerializeField] private Animator fish;
[SerializeField] private GameObject rollPlatform;
private bool playYanIsFalling;
private double playYanFallBeat;
private bool isFish;
private bool isFinalBlock;
private bool isEndEvent;
private bool nextPlatformIsSameHeight;
private bool isRollPlatform;
public void StartInput(double beat, double hitBeat)
{
@ -47,43 +50,52 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
lastAdditionalHeightInUnits = game.FindHeightUnitsAtBeat(hitBeat);
additionalHeightInUnits = game.FindHeightUnitsAtBeat(hitBeat + 1);
additionalHeight = lastAdditionalHeightInUnits * handler.heightAmount;
bool nextPlatformIsSameHeight = lastAdditionalHeightInUnits == additionalHeightInUnits;
nextPlatformIsSameHeight = lastAdditionalHeightInUnits == additionalHeightInUnits;
isFinalBlock = hitBeat == game.endBeat + 1;
platform.SetActive(nextPlatformIsSameHeight && !isFinalBlock);
startBeat = beat;
endBeat = hitBeat;
if (game.RollOnBeat(endBeat - 1)) endBeat += handler.platformCount;
isFish = game.FishOnBeat(endBeat);
fish.gameObject.SetActive(isFish);
isEndEvent = game.endBeat == endBeat;
if (isEndEvent) anim.Play("EndIdle", 0, 0);
if (game.platformTypes.ContainsKey(hitBeat))
isRollPlatform = !isEndEvent && game.RollOnBeat(endBeat);
rollPlatform.SetActive(isRollPlatform);
if (isRollPlatform)
{
if (game.platformTypes[hitBeat].platformType == AgbNightWalk.PlatformType.Lollipop)
{
type = PlatformType.Lollipop;
}
else
{
type = PlatformType.Umbrella;
}
doFillStartSound = false;
platform.SetActive(false);
}
else
{
type = PlatformType.Flower;
if (game.platformTypes.ContainsKey(hitBeat + 1))
{
doFillStartSound = game.platformTypes[hitBeat + 1].fillType != AgbNightWalk.FillType.None;
}
}
if (startBeat < endBeat)
{
if (game.ShouldNotJumpOnBeat(endBeat) || isFish)
if (game.platformTypes.ContainsKey(hitBeat))
{
inputEvent = AgbNightWalk.instance.ScheduleUserInput(startBeat, endBeat - startBeat, InputType.STANDARD_DOWN, isEndEvent ? JustEnd : Just, Miss, Empty);
if (nextPlatformIsSameHeight && !isFinalBlock)
if (game.platformTypes[hitBeat].platformType == AgbNightWalk.PlatformType.Lollipop)
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
type = PlatformType.Lollipop;
}
else
{
type = PlatformType.Umbrella;
}
doFillStartSound = false;
}
else
{
type = PlatformType.Flower;
if (game.platformTypes.ContainsKey(hitBeat + 1))
{
doFillStartSound = game.platformTypes[hitBeat + 1].fillType != AgbNightWalk.FillType.None;
}
}
if (startBeat < endBeat)
{
if (game.ShouldNotJumpOnBeat(endBeat) || isFish)
{
inputEvent = AgbNightWalk.instance.ScheduleUserInput(startBeat, endBeat - startBeat, InputType.STANDARD_DOWN, isEndEvent ? JustEnd : Just, Miss, Empty);
if (nextPlatformIsSameHeight && !isFinalBlock)
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(endBeat, delegate
{
@ -101,10 +113,10 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
}
})
});
}
else
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
}
else
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(endBeat, delegate
{
@ -119,19 +131,19 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
}
})
});
}
}
}
else if (!isFish)
{
inputEvent = AgbNightWalk.instance.ScheduleInput(startBeat, endBeat - startBeat, InputType.STANDARD_DOWN, isEndEvent ? JustEnd : Just, Miss, Empty);
}
if (nextPlatformIsSameHeight && !isEndEvent)
{
canKick = true;
BeatAction.New(gameObject, new List<BeatAction.Action>()
else if (!isFish)
{
new BeatAction.Action(endBeat, delegate
{
inputEvent = AgbNightWalk.instance.ScheduleInput(startBeat, endBeat - startBeat, InputType.STANDARD_DOWN, isEndEvent ? JustEnd : Just, Miss, Empty);
}
if (nextPlatformIsSameHeight && !isEndEvent)
{
canKick = true;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(endBeat, delegate
{
if (!stopped)
{
SoundByte.PlayOneShotGame("nightWalkAgb/boxKick");
@ -142,8 +154,9 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
}
})
});
}
}
}
}
}
@ -330,7 +343,7 @@ namespace HeavenStudio.Games.Scripts_AgbNightWalk
private void Miss(PlayerActionEvent caller)
{
if (platform.activeSelf)
if (nextPlatformIsSameHeight)
{
game.playYan.Walk();
SoundByte.PlayOneShotGame("nightWalkAgb/open" + (int)type, caller.timer + caller.startBeat + 0.5);