Bots can be filled wow

This commit is contained in:
Rapandrasmus 2023-06-11 12:57:43 +02:00
parent 4fdf938f43
commit 14de368bab
6 changed files with 135 additions and 6 deletions

View file

@ -156,7 +156,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: -3
m_SortingOrder: -30
m_Sprite: {fileID: 173218995, guid: 5dc7371021b121c4a9c5d788cb912362, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
@ -1238,7 +1238,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: -2
m_SortingOrder: -20
m_Sprite: {fileID: -283017777, guid: 5dc7371021b121c4a9c5d788cb912362, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
@ -2049,7 +2049,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: -2
m_SortingOrder: -20
m_Sprite: {fileID: -283017777, guid: 5dc7371021b121c4a9c5d788cb912362, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
@ -2133,7 +2133,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: -1
m_SortingOrder: -10
m_Sprite: {fileID: -1382868650, guid: 5dc7371021b121c4a9c5d788cb912362, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0

View file

@ -671,6 +671,7 @@ MonoBehaviour:
legs: {fileID: 7489285146181854031}
body: {fileID: 233663896046199226}
head: {fileID: 1555999227183591988}
fillAnim: {fileID: 3960380650713155144}
--- !u!1 &7716400162364290482
GameObject:
m_ObjectHideFlags: 0

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: c2c8d0b9dd6e5c248b1a1c381282e7ce
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View file

@ -103,7 +103,10 @@ namespace HeavenStudio.Games
private void SpawnFillbot(double beat, double holdLength, BotSize size, BotVariant variant)
{
NtrFillbot spawnedBot = Instantiate(mediumBot, transform);
spawnedBot.holdLength = holdLength;
if (holdLength > 0)
{
spawnedBot.holdLength = holdLength;
}
spawnedBot.Init(beat);
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{

View file

@ -24,7 +24,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots
[Header("Properties")]
[SerializeField] private BotSize size;
[SerializeField] private BotVariant variant;
public double holdLength = 4;
public double holdLength = 4f;
[SerializeField] private float limbFallHeight = 15f;
[Header("Body Parts")]
@ -36,6 +36,8 @@ namespace HeavenStudio.Games.Scripts_Fillbots
[SerializeField] private Animator head;
private Transform headTrans;
[SerializeField] private Animator fillAnim;
private float legsPosY;
private float bodyPosY;
private float headPosY;
@ -48,6 +50,21 @@ namespace HeavenStudio.Games.Scripts_Fillbots
private Fillbots game;
private float startPosX;
private GameEvent beepEvent;
private PlayerActionEvent releaseEvent;
private Sound fillSound;
private bool holding;
private void OnDestroy()
{
if (fillSound != null) fillSound.KillLoop(0);
}
private void Awake()
{
game = Fillbots.instance;
@ -62,6 +79,8 @@ namespace HeavenStudio.Games.Scripts_Fillbots
legsTrans.position = new Vector3(legsTrans.position.x, legsTrans.position.y + limbFallHeight);
headTrans.position = new Vector3(headTrans.position.x, headTrans.position.y + limbFallHeight);
bodyTrans.position = new Vector3(bodyTrans.position.x, bodyTrans.position.y + limbFallHeight);
startPosX = transform.position.x;
}
public void Init(double beat)
@ -96,6 +115,8 @@ namespace HeavenStudio.Games.Scripts_Fillbots
new MultiSound.Sound("fillbots/" + sizePrefix + "Fall", beat + 1),
new MultiSound.Sound("fillbots/" + sizePrefix + "Fall", beat + 2),
});
game.ScheduleInput(startBeat, 4, InputType.STANDARD_DOWN, JustHold, HoldOut, HoldOut);
}
private void Update()
@ -125,8 +146,90 @@ namespace HeavenStudio.Games.Scripts_Fillbots
headTrans.position = new Vector3(headTrans.position.x, Mathf.Clamp(lerpedY, headPosY, headPosY + limbFallHeight));
}
}
if (beepEvent != null && beepEvent.enabled && cond.ReportBeat(ref beepEvent.lastReportedBeat))
{
if (beepEvent.lastReportedBeat < beepEvent.startBeat + beepEvent.length)
{
SoundByte.PlayOneShotGame("fillbots/beep");
}
fullBody.DoScaledAnimationAsync("HoldBeat", 1f);
game.filler.DoScaledAnimationAsync("HoldBeat", 1f);
}
if (holding)
{
float normalizedBeat = cond.GetPositionFromBeat(startBeat + 4, holdLength);
fillAnim.DoNormalizedAnimation("Fill", Mathf.Clamp(normalizedBeat, 0, 1));
if (PlayerInput.PressedUp() && !game.IsExpectingInputNow(InputType.STANDARD_UP))
{
fullBody.Play("Dead", 0, 0);
holding = false;
}
}
}
}
private void JustHold(PlayerActionEvent caller, float state)
{
if (state >= 1f || state <= -1f)
{
fullBody.Play("HoldBarely", 0, 0);
return;
}
holding = true;
fullBody.DoScaledAnimationAsync("Hold", 1f);
game.filler.DoScaledAnimationAsync("Hold", 0.5f);
SoundByte.PlayOneShotGame("fillbots/armExtension");
SoundByte.PlayOneShotGame("fillbots/beep");
fillSound = SoundByte.PlayOneShotGame("fillbots/water", -1, 1 / ((float)holdLength * 0.25f), 1, true);
releaseEvent = game.ScheduleInput(startBeat + 4, holdLength, InputType.STANDARD_UP, JustRelease, OutRelease, OutRelease);
beepEvent = new GameEvent()
{
startBeat = startBeat + 4,
lastReportedBeat = startBeat + 4,
length = (float)holdLength,
enabled = true
};
}
private void HoldOut(PlayerActionEvent caller)
{
}
private void JustRelease(PlayerActionEvent caller, float state)
{
fillSound.KillLoop(0);
beepEvent.enabled = false;
holding = false;
game.filler.DoScaledAnimationAsync("Release", 0.5f);
if (state >= 1f || state <= -1f)
{
return;
}
SoundByte.PlayOneShotGame("fillbots/armRetraction");
fullBody.DoScaledAnimationAsync("Release", 1f);
string sizePrefix = size switch
{
BotSize.Small => "small",
BotSize.Medium => "medium",
BotSize.Large => "big",
_ => throw new System.NotImplementedException()
};
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("fillbots/" + sizePrefix + "Move", caller.startBeat + caller.timer + 0.5),
new MultiSound.Sound("fillbots/" + sizePrefix + "OK1", caller.startBeat + caller.timer + 0.5),
new MultiSound.Sound("fillbots/" + sizePrefix + "OK2", caller.startBeat + caller.timer + 1),
});
}
private void OutRelease(PlayerActionEvent caller)
{
}
}
}