Fly Animation

This commit is contained in:
fu-majime 2024-03-31 22:45:32 +09:00
parent ced933fd28
commit 7cebb7bfca
9 changed files with 321 additions and 169 deletions

View file

@ -870,15 +870,16 @@ MonoBehaviour:
size: 2
holdLength: 7
limbFallHeight: 15
fuelCorol: {r: 1, g: 0.385, b: 0.385, a: 1}
lampCorolOff: {r: 0.635, g: 0.635, b: 0.185, a: 1}
lampCorolOn: {r: 1, g: 1, b: 0.42, a: 1}
fuelColor: {r: 1, g: 0.385, b: 0.385, a: 1}
lampColorOff: {r: 0, g: 0, b: 0, a: 0}
lampColorOn: {r: 0, g: 0, b: 0, a: 0}
fullBody: {fileID: 7967358876063018519}
legs: {fileID: 7489285146181854031}
body: {fileID: 233663896046199226}
head: {fileID: 1555999227183591988}
fuelFill: {fileID: 1253665520920512372}
fillAnim: {fileID: 3960380650713155144}
flyDistance: 2.05
--- !u!210 &755017336671867292
SortingGroup:
m_ObjectHideFlags: 0

View file

@ -870,15 +870,16 @@ MonoBehaviour:
size: 1
holdLength: 3
limbFallHeight: 15
fuelCorol: {r: 1, g: 0.385, b: 0.385, a: 1}
lampCorolOff: {r: 0.635, g: 0.635, b: 0.185, a: 1}
lampCorolOn: {r: 1, g: 1, b: 0.42, a: 1}
fuelColor: {r: 0, g: 0, b: 0, a: 0}
lampColorOff: {r: 0, g: 0, b: 0, a: 0}
lampColorOn: {r: 0, g: 0, b: 0, a: 0}
fullBody: {fileID: 7967358876063018519}
legs: {fileID: 7489285146181854031}
body: {fileID: 233663896046199226}
head: {fileID: 1555999227183591988}
fuelFill: {fileID: 1253665520920512372}
fillAnim: {fileID: 3960380650713155144}
flyDistance: 2.05
--- !u!210 &755017336671867292
SortingGroup:
m_ObjectHideFlags: 0

View file

@ -870,15 +870,16 @@ MonoBehaviour:
size: 0
holdLength: 1
limbFallHeight: 15
fuelCorol: {r: 1, g: 0.385, b: 0.385, a: 1}
lampCorolOff: {r: 0.635, g: 0.635, b: 0.185, a: 1}
lampCorolOn: {r: 1, g: 1, b: 0.42, a: 1}
fuelColor: {r: 0, g: 0, b: 0, a: 0}
lampColorOff: {r: 0, g: 0, b: 0, a: 0}
lampColorOn: {r: 0, g: 0, b: 0, a: 0}
fullBody: {fileID: 7967358876063018519}
legs: {fileID: 7489285146181854031}
body: {fileID: 233663896046199226}
head: {fileID: 1555999227183591988}
fuelFill: {fileID: 1253665520920512372}
fillAnim: {fileID: 3960380650713155144}
flyDistance: 2.05
--- !u!210 &755017336671867292
SortingGroup:
m_ObjectHideFlags: 0

View file

@ -41,15 +41,6 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.083333336
value: 0
inSlope: Infinity
outSlope: Infinity
@ -58,7 +49,7 @@ AnimationClip:
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.16666667
time: 0.05
value: 1
inSlope: Infinity
outSlope: Infinity
@ -66,6 +57,15 @@ AnimationClip:
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.1
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
@ -116,7 +116,7 @@ AnimationClip:
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.16666667
m_StopTime: 0.1
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
@ -156,15 +156,6 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.083333336
value: 0
inSlope: Infinity
outSlope: Infinity
@ -173,7 +164,7 @@ AnimationClip:
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.16666667
time: 0.05
value: 1
inSlope: Infinity
outSlope: Infinity
@ -181,6 +172,15 @@ AnimationClip:
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.1
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4

View file

@ -41,15 +41,6 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.083333336
value: 0
inSlope: Infinity
outSlope: Infinity
@ -58,7 +49,7 @@ AnimationClip:
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.16666667
time: 0.05
value: 1
inSlope: Infinity
outSlope: Infinity
@ -66,6 +57,15 @@ AnimationClip:
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.1
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
@ -116,7 +116,7 @@ AnimationClip:
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.16666667
m_StopTime: 0.1
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
@ -156,15 +156,6 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.083333336
value: 0
inSlope: Infinity
outSlope: Infinity
@ -173,7 +164,7 @@ AnimationClip:
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.16666667
time: 0.05
value: 1
inSlope: Infinity
outSlope: Infinity
@ -181,6 +172,15 @@ AnimationClip:
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.1
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4

View file

@ -14,7 +14,41 @@ AnimationClip:
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_PositionCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: {x: 0, y: 0, z: 0}
inSlope: {x: Infinity, y: Infinity, z: 0}
outSlope: {x: Infinity, y: Infinity, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.083333336
value: {x: 0, y: 0, z: 0}
inSlope: {x: Infinity, y: Infinity, z: 0}
outSlope: {x: Infinity, y: Infinity, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.16666667
value: {x: 0.15, y: 0.07, z: 0}
inSlope: {x: Infinity, y: Infinity, z: 0}
outSlope: {x: Infinity, y: Infinity, z: 0}
tangentMode: 0
weightedMode: 0
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
path:
m_ScaleCurves: []
m_FloatCurves:
- curve:
@ -55,6 +89,13 @@ AnimationClip:
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 1
script: {fileID: 0}
typeID: 4
customType: 0
isPPtrCurve: 0
- serializedVersion: 2
path: 3747441678
attribute: 2086281974
@ -113,8 +154,101 @@ AnimationClip:
path: Mask
classID: 1
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.083333336
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.16666667
value: 0.15
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.x
path:
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.083333336
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.16666667
value: 0.07
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.y
path:
classID: 4
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_LocalPosition.z
path:
classID: 4
script: {fileID: 0}
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasGenericRootTransform: 1
m_HasMotionFloatCurves: 0
m_Events:
- time: 0

View file

@ -41,15 +41,6 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.083333336
value: 0
inSlope: Infinity
outSlope: Infinity
@ -58,7 +49,7 @@ AnimationClip:
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.16666667
time: 0.05
value: 1
inSlope: Infinity
outSlope: Infinity
@ -66,6 +57,15 @@ AnimationClip:
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.1
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
@ -116,7 +116,7 @@ AnimationClip:
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.16666667
m_StopTime: 0.1
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
@ -156,15 +156,6 @@ AnimationClip:
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.083333336
value: 0
inSlope: Infinity
outSlope: Infinity
@ -173,7 +164,7 @@ AnimationClip:
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.16666667
time: 0.05
value: 1
inSlope: Infinity
outSlope: Infinity
@ -181,6 +172,15 @@ AnimationClip:
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.1
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4

View file

@ -30,12 +30,13 @@ namespace HeavenStudio.Games.Loaders
{
preFunction = delegate {
var e = eventCaller.currentEntity;
Fillbots.PreSpawnFillbot(e.beat, 3, Scripts_Fillbots.BotSize.Medium, e["colorFuel"], e["colorLampOff"], e["colorLampOn"]);
Fillbots.PreSpawnFillbot(e.beat, 3, Scripts_Fillbots.BotSize.Medium, e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"]);
},
defaultLength = 8f,
parameters = new List<Param>()
{
new Param("type", Scripts_Fillbots.EndType.Both, "Success Reaction", "Set the reaction of the Robot."),
new Param("alt", false, "Alternate OK"),
new Param("type", Scripts_Fillbots.EndAnim.Both, "Success Reaction", "Set the reaction of the Robot."),
new Param("colorFuel", new Color(1f, 0.385f, 0.385f), "Fuel Color", "Set the color of the fuel."),
new Param("colorLampOff", new Color(0.635f, 0.635f, 0.185f), "Off Lamp Color", "Set the color of the off lamp."),
new Param("colorLampOn", new Color(1f, 1f, 0.42f), "On Lamp Color", "Set the color of the on lamp."),
@ -45,12 +46,13 @@ namespace HeavenStudio.Games.Loaders
{
preFunction = delegate {
var e = eventCaller.currentEntity;
Fillbots.PreSpawnFillbot(e.beat, 7, Scripts_Fillbots.BotSize.Large, e["colorFuel"], e["colorLampOff"], e["colorLampOn"]);
Fillbots.PreSpawnFillbot(e.beat, 7, Scripts_Fillbots.BotSize.Large, e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"]);
},
defaultLength = 12f,
parameters = new List<Param>()
{
new Param("type", Scripts_Fillbots.EndType.Both, "Success Reaction", "Set the reaction of the Robot."),
new Param("alt", false, "Alternate OK"),
new Param("type", Scripts_Fillbots.EndAnim.Both, "Success Reaction", "Set the reaction of the Robot."),
new Param("colorFuel", new Color(1f, 0.385f, 0.385f), "Fuel Color", "Set the color of the fuel."),
new Param("colorLampOff", new Color(0.635f, 0.635f, 0.185f), "Off Lamp Color", "Set the color of the off lamp."),
new Param("colorLampOn", new Color(1f, 1f, 0.42f), "On Lamp Color", "Set the color of the on lamp."),
@ -60,12 +62,13 @@ namespace HeavenStudio.Games.Loaders
{
preFunction = delegate {
var e = eventCaller.currentEntity;
Fillbots.PreSpawnFillbot(e.beat, 1, Scripts_Fillbots.BotSize.Small, e["colorFuel"], e["colorLampOff"], e["colorLampOn"]);
Fillbots.PreSpawnFillbot(e.beat, 1, Scripts_Fillbots.BotSize.Small, e["colorFuel"], e["colorLampOff"], e["colorLampOn"], e["type"], e["alt"]);
},
defaultLength = 6f,
parameters = new List<Param>()
{
new Param("type", Scripts_Fillbots.EndType.Both, "Success Reaction", "Set the reaction of the Robot."),
new Param("alt", false, "Alternate OK"),
new Param("type", Scripts_Fillbots.EndAnim.Both, "Success Reaction", "Set the reaction of the Robot."),
new Param("colorFuel", new Color(1f, 0.385f, 0.385f), "Fuel Color", "Set the color of the fuel."),
new Param("colorLampOff", new Color(0.635f, 0.635f, 0.185f), "Off Lamp Color", "Set the color of the off lamp."),
new Param("colorLampOn", new Color(1f, 1f, 0.42f), "On Lamp Color", "Set the color of the on lamp."),
@ -119,6 +122,8 @@ namespace HeavenStudio.Games
public Color fuelColor;
public Color lampColorOff;
public Color lampColorOn;
public EndAnim endAnim;
public bool altOK;
}
private static List<QueuedFillbot> queuedBots = new List<QueuedFillbot>();
@ -136,14 +141,16 @@ namespace HeavenStudio.Games
[System.NonSerialized] public BotSize fillerPosition = BotSize.Medium;
public static Fillbots instance;
[NonSerialized] public List<NtrFillbot> currentBots = new List<NtrFillbot>();
[NonSerialized] public double conveyerStartBeat = -1;
[NonSerialized] public float conveyerNormalizedOffset;
private int toggleGlobal = 0;
public static Fillbots instance;
private void Awake()
{
instance = this;
@ -152,8 +159,10 @@ namespace HeavenStudio.Games
public override void OnBeatPulse(double beat)
{
int toggle = (int)(beat % 2);
if (BeatIsInBopRegion(beat)) Bop(toggle);
if (BeatIsInBopRegion(beat)) {
Bop(toggleGlobal);
toggleGlobal ^= 1;
}
}
private void OnDestroy()
@ -174,7 +183,7 @@ namespace HeavenStudio.Games
{
foreach (var queuedBot in queuedBots)
{
SpawnFillbot(queuedBot.beat, queuedBot.holdLength, queuedBot.size, queuedBot.fuelColor, queuedBot.lampColorOff, queuedBot.lampColorOn);
SpawnFillbot(queuedBot.beat, queuedBot.holdLength, queuedBot.size, queuedBot.fuelColor, queuedBot.lampColorOff, queuedBot.lampColorOn, queuedBot.endAnim, queuedBot.altOK);
}
queuedBots.Clear();
}
@ -203,56 +212,16 @@ namespace HeavenStudio.Games
SoundByte.PlayOneShotGame("fillbots/armRetractionWhiff");
}
if (conveyerStartBeat >= 0)
{
float normalizedBeat = cond.GetPositionFromBeat(conveyerStartBeat, 1);
if (normalizedBeat >= 0)
{
for (int i = 0; i < currentBots.Count; i++)
{
var bot = currentBots[i];
bot.MoveConveyer(normalizedBeat);
}
conveyerBelt.Play("Move", -1, ((normalizedBeat + conveyerNormalizedOffset) % 1) / 4);
foreach (var gear in gears)
{
gear.localEulerAngles = new Vector3(0, 0, Mathf.LerpUnclamped(0, 90, normalizedBeat + conveyerNormalizedOffset));
}
}
else
{
foreach (var bot in currentBots)
{
bot.StopConveyer();
}
conveyerBelt.Play("Move", -1, (conveyerNormalizedOffset % 1) / 4);
foreach (var gear in gears)
{
gear.localEulerAngles = new Vector3(0, 0, Mathf.LerpUnclamped(0, 90, conveyerNormalizedOffset));
}
}
}
else
{
foreach (var bot in currentBots)
{
bot.StopConveyer();
}
conveyerBelt.Play("Move", -1, (conveyerNormalizedOffset % 1) / 4);
foreach (var gear in gears)
{
gear.localEulerAngles = new Vector3(0, 0, Mathf.LerpUnclamped(0, 90, conveyerNormalizedOffset));
}
}
UpdateConveyerBelt(conveyerStartBeat, conveyerNormalizedOffset);
}
}
public static void PreSpawnFillbot(double beat, double holdLength, BotSize size, Color fuelColor, Color lampColorOff, Color lampColorOn)
public static void PreSpawnFillbot(double beat, double holdLength, BotSize size, Color fuelColor, Color lampColorOff, Color lampColorOn, int endAnim, bool altOK)
{
Debug.Log(altOK);
if (GameManager.instance.currentGame == "fillbots")
{
instance.SpawnFillbot(beat, holdLength, size, fuelColor, lampColorOff, lampColorOn);
instance.SpawnFillbot(beat, holdLength, size, fuelColor, lampColorOff, lampColorOn, (EndAnim)endAnim, altOK);
}
else
{
@ -264,11 +233,13 @@ namespace HeavenStudio.Games
fuelColor = fuelColor,
lampColorOff = lampColorOff,
lampColorOn = lampColorOn,
endAnim = (EndAnim)endAnim,
altOK = altOK,
});
}
}
private void SpawnFillbot(double beat, double holdLength, BotSize size, Color fuelColor, Color lampColorOff, Color lampColorOn)
private void SpawnFillbot(double beat, double holdLength, BotSize size, Color fuelColor, Color lampColorOff, Color lampColorOn, EndAnim endAnim, bool altOK)
{
NtrFillbot Bot = size switch
{
@ -286,11 +257,13 @@ namespace HeavenStudio.Games
spawnedBot.fuelColor = fuelColor;
spawnedBot.lampColorOff = lampColorOff;
spawnedBot.lampColorOn = lampColorOn;
spawnedBot.endAnim = endAnim;
spawnedBot.altOK = altOK;
spawnedBot.Init(beat);
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate
new BeatAction.Action(beat - 0.5, delegate
{
if (conveyerStartBeat != -1) conveyerNormalizedOffset = Conductor.instance.GetPositionFromBeat(conveyerStartBeat, 1);
conveyerStartBeat = -2;
@ -298,8 +271,8 @@ namespace HeavenStudio.Games
new BeatAction.Action(beat + 3, delegate
{
if (!PlayerInput.GetIsAction(InputAction_BasicPress)) filler.DoScaledAnimationAsync("FillerPrepare", 0.5f);
fillerPosition = size;
conveyerStartBeat = beat + 3;
fillerPosition = size;
})
});
}
@ -313,8 +286,8 @@ namespace HeavenStudio.Games
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + i, delegate {
int toggle = (int)((beat + i) % 2);
Bop(toggle);
Bop(toggleGlobal);
toggleGlobal ^= 1;
})
});
}
@ -334,6 +307,22 @@ namespace HeavenStudio.Games
}
}
private void UpdateConveyerBelt(double startBeat, float offset)
{
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 1);
float playTime = ((startBeat >= 0 && normalizedBeat >= 0) ? (normalizedBeat + offset) : offset) % 1 / 4;
conveyerBelt.Play("Move", -1, playTime);
UpdateGears((startBeat >= 0 && normalizedBeat >= 0) ? normalizedBeat + offset : offset);
}
private void UpdateGears(float beat)
{
foreach (var gear in gears)
{
gear.localEulerAngles = new Vector3(0, 0, Mathf.LerpUnclamped(0, -90, beat));
}
}
public void Blackout()
{
blackout.SetActive(!blackout.activeSelf);

View file

@ -21,7 +21,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots
Ng,
}
public enum EndType
public enum EndAnim
{
Both,
Ace,
@ -34,11 +34,17 @@ namespace HeavenStudio.Games.Scripts_Fillbots
[SerializeField] private BotSize size;
public double holdLength = 4f;
[SerializeField] private float limbFallHeight = 15f;
public Color fuelColor;
public Color lampColorOff;
public Color lampColorOn;
[System.NonSerialized] public Color fuelColor;
[System.NonSerialized] public Color lampColorOff;
[System.NonSerialized] public Color lampColorOn;
double conveyerRestartLength = 0.5;
private Vector2 startPos;
private float lerpDistance;
[SerializeField] private float flyDistance;
private float stackDistanceRate = 0.2f;
[Header("Body Parts")]
[SerializeField] private Animator fullBody;
private Material fullBodyMaterial;
@ -57,6 +63,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots
private float headPosY;
private double startBeat = -1;
private double conveyerStartBeat = -1;
private bool legsHaveFallen;
private bool bodyHasFallen;
@ -64,8 +71,6 @@ namespace HeavenStudio.Games.Scripts_Fillbots
private Fillbots game;
private float startPosX;
private GameEvent beepEvent;
private PlayerActionEvent releaseEvent;
@ -75,8 +80,8 @@ namespace HeavenStudio.Games.Scripts_Fillbots
private BotState botState = BotState.Idle;
private bool isExplode = false;
private float lerpDistance;
private float stackDistanceRate = 0.2f;
[System.NonSerialized] public EndAnim endAnim;
[System.NonSerialized] public bool altOK;
private float normalizedFill;
@ -100,9 +105,9 @@ namespace HeavenStudio.Games.Scripts_Fillbots
bodyTrans.position = new Vector3(bodyTrans.position.x, bodyTrans.position.y + limbFallHeight);
headTrans.position = new Vector3(headTrans.position.x, headTrans.position.y + limbFallHeight);
startPosX = transform.position.x;
startPos = transform.position;
lerpDistance = 0 - startPosX;
lerpDistance = 0 - startPos.x;
}
public void MoveConveyer(float normalized)
@ -113,7 +118,7 @@ namespace HeavenStudio.Games.Scripts_Fillbots
return;
}
if (!headHasFallen || !bodyHasFallen || !legsHaveFallen) return;
transform.position = new Vector3(Mathf.LerpUnclamped(startPosX, startPosX + lerpDistance, normalized), transform.position.y);
transform.position = new Vector3(Mathf.LerpUnclamped(startPos.x, startPos.x + lerpDistance, normalized), startPos.y);
if (normalized >= 4)
{
@ -122,15 +127,29 @@ namespace HeavenStudio.Games.Scripts_Fillbots
}
}
public void FlyConveyer(float normalized)
{
if (botState is not BotState.Ace) return;
if (!headHasFallen || !bodyHasFallen || !legsHaveFallen) return;
transform.position = new Vector3(Mathf.LerpUnclamped(startPos.x, startPos.x + lerpDistance, normalized),
Mathf.LerpUnclamped(startPos.y, startPos.y + flyDistance, normalized));
if (normalized >= 4)
{
game.currentBots.Remove(this);
Destroy(gameObject);
}
}
public void StopConveyer()
{
if (!headHasFallen || !bodyHasFallen || !legsHaveFallen) return;
startPosX = transform.position.x;
startPos = transform.position;
}
public void Init(double beat)
{
startBeat = beat;
conveyerStartBeat = beat + 3;
fullBodyMaterial = fullBody.GetComponent<SpriteRenderer>().material;
fullBodyMaterial.SetColor("_ColorBravo", fuelColor);
@ -207,6 +226,16 @@ namespace HeavenStudio.Games.Scripts_Fillbots
float lerpedY = Mathf.Lerp(headPosY + limbFallHeight, headPosY, normalizedBeat);
headTrans.position = new Vector3(headTrans.position.x, Mathf.Clamp(lerpedY, headPosY, headPosY + limbFallHeight));
}
if (true)
{
float normalizedBeat = cond.GetPositionFromBeat(this.conveyerStartBeat, 1);
if (normalizedBeat >= 0)
{
if (botState is BotState.Ace) FlyConveyer(normalizedBeat);
else MoveConveyer(normalizedBeat);
}
}
}
if (botState is BotState.Holding)
@ -251,30 +280,19 @@ namespace HeavenStudio.Games.Scripts_Fillbots
if (normalizedBeat < 1)
{
fullBody.Play("Dead", 0, 0);
fillSound.KillLoop(0);
beepEvent.enabled = false;
botState = BotState.Ng;
normalizedFill = normalizedBeat;
SoundByte.PlayOneShotGame("fillbots/miss");
if (game.conveyerStartBeat == -1) game.conveyerStartBeat = cond.songPositionInBeats + conveyerRestartLength;
}
else if (!isExplode)
{
fullBody.DoScaledAnimationAsync("ReleaseLate", 0.5f);
SoundByte.PlayOneShotGame("fillbots/miss");
}
fillSound.KillLoop(0);
beepEvent.enabled = false;
botState = BotState.Ng;
normalizedFill = normalizedBeat;
SoundByte.PlayOneShotGame("fillbots/miss");
if (game.conveyerStartBeat == -1) game.conveyerStartBeat = cond.songPositionInBeats + conveyerRestartLength;
}
else
{
fillSound.KillLoop(0);
beepEvent.enabled = false;
normalizedFill = normalizedBeat;
if (game.conveyerStartBeat == -1) game.conveyerStartBeat = cond.songPositionInBeats + conveyerRestartLength;
}
this.conveyerStartBeat = cond.songPositionInBeats + conveyerRestartLength;
if (game.conveyerStartBeat == -1) game.conveyerStartBeat = this.conveyerStartBeat;
releaseEvent.Disable();
}
}
@ -302,9 +320,9 @@ namespace HeavenStudio.Games.Scripts_Fillbots
BotSize.Large => "Large",
_ => throw new System.NotImplementedException()
};
game.filler.DoScaledAnimationAsync("Hold" + sizeSuffix, 0.5f);
SoundByte.PlayOneShotGame("fillbots/armExtension");
if (state >= 1f || state <= -1f)
{
fullBody.Play("HoldBarely", 0, 0);
@ -331,7 +349,8 @@ namespace HeavenStudio.Games.Scripts_Fillbots
{
fillSound.KillLoop(0);
beepEvent.enabled = false;
if (game.conveyerStartBeat != -2) game.conveyerStartBeat = caller.timer + caller.startBeat + conveyerRestartLength;
this.conveyerStartBeat = caller.timer + caller.startBeat + conveyerRestartLength;
if (game.conveyerStartBeat != -2) game.conveyerStartBeat = this.conveyerStartBeat;
string sizeSuffix = game.fillerPosition switch
{
@ -358,9 +377,16 @@ namespace HeavenStudio.Games.Scripts_Fillbots
fullBody.DoScaledAnimationAsync("ReleaseEarly", 0.5f);
return;
}
if (state == 0)
if ((endAnim is EndAnim.Both && state == 0) || endAnim is EndAnim.Ace)
{
botState = BotState.Ace;
BeatAction.New(game, new List<BeatAction.Action>()
{
new BeatAction.Action(caller.startBeat + caller.timer + 0.5, delegate {
fullBody.DoScaledAnimationAsync("Fly", 0.5f);
}),
});
}
else
{
@ -389,9 +415,9 @@ namespace HeavenStudio.Games.Scripts_Fillbots
};
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),
new MultiSound.Sound("fillbots/" + sizePrefix + "Move", caller.startBeat + caller.timer + (altOK ? 0 : 0.5)),
new MultiSound.Sound("fillbots/" + sizePrefix + "OK1", caller.startBeat + caller.timer + (altOK ? 0 : 0.5)),
new MultiSound.Sound("fillbots/" + sizePrefix + "OK2", caller.startBeat + caller.timer + (altOK ? 0.5 : 1)),
});
}