truly, and dearly, finished?
NOPE! UNITY ANIMATION BUG :D
This commit is contained in:
parent
b3542dfe6b
commit
8e3a1835fc
|
|
@ -1095,7 +1095,6 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 1612270337899650120}
|
||||
- component: {fileID: 1827108650296241172}
|
||||
- component: {fileID: 8880821737167752546}
|
||||
m_Layer: 0
|
||||
m_Name: Big
|
||||
m_TagString: Untagged
|
||||
|
|
@ -1170,27 +1169,6 @@ SpriteRenderer:
|
|||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!95 &8880821737167752546
|
||||
Animator:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2519758725549188593}
|
||||
m_Enabled: 1
|
||||
m_Avatar: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000, guid: d43b9052abbcc984bafbb1cc011790fa, type: 2}
|
||||
m_CullingMode: 0
|
||||
m_UpdateMode: 0
|
||||
m_ApplyRootMotion: 0
|
||||
m_LinearVelocityBlending: 0
|
||||
m_StabilizeFeet: 0
|
||||
m_WarningMessage:
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorStateOnDisable: 0
|
||||
m_WriteDefaultValuesOnDisable: 0
|
||||
--- !u!1 &2548421022527636111
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -1334,12 +1312,12 @@ MonoBehaviour:
|
|||
TackAnim: {fileID: 8591333713642157499}
|
||||
CartGuyParentAnim: {fileID: 8490229799144356405}
|
||||
CartGuyAnim: {fileID: 2660979752167028621}
|
||||
GearAnims:
|
||||
- {fileID: 2010620652897398612}
|
||||
- {fileID: 8277077324340739918}
|
||||
- {fileID: 8880821737167752546}
|
||||
- {fileID: 8634187518571851645}
|
||||
- {fileID: 1267443179515578174}
|
||||
Gears:
|
||||
- {fileID: 4255429133276147351}
|
||||
- {fileID: 6673086640620398125}
|
||||
- {fileID: 1612270337899650120}
|
||||
- {fileID: 8638372891015524707}
|
||||
- {fileID: 8463963395356207829}
|
||||
bossAnnoyed: 0
|
||||
--- !u!1 &2707801222513399487
|
||||
GameObject:
|
||||
|
|
@ -1550,7 +1528,6 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 8463963395356207829}
|
||||
- component: {fileID: 5740312479299997546}
|
||||
- component: {fileID: 1267443179515578174}
|
||||
m_Layer: 0
|
||||
m_Name: Big
|
||||
m_TagString: Untagged
|
||||
|
|
@ -1625,27 +1602,6 @@ SpriteRenderer:
|
|||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!95 &1267443179515578174
|
||||
Animator:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3884870158331433142}
|
||||
m_Enabled: 1
|
||||
m_Avatar: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000, guid: d43b9052abbcc984bafbb1cc011790fa, type: 2}
|
||||
m_CullingMode: 0
|
||||
m_UpdateMode: 0
|
||||
m_ApplyRootMotion: 0
|
||||
m_LinearVelocityBlending: 0
|
||||
m_StabilizeFeet: 0
|
||||
m_WarningMessage:
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorStateOnDisable: 0
|
||||
m_WriteDefaultValuesOnDisable: 0
|
||||
--- !u!1 &3967206461167035201
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -1942,7 +1898,6 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 6673086640620398125}
|
||||
- component: {fileID: 4781199580935872767}
|
||||
- component: {fileID: 8277077324340739918}
|
||||
m_Layer: 0
|
||||
m_Name: Small
|
||||
m_TagString: Untagged
|
||||
|
|
@ -2017,27 +1972,6 @@ SpriteRenderer:
|
|||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!95 &8277077324340739918
|
||||
Animator:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5027933940018834288}
|
||||
m_Enabled: 1
|
||||
m_Avatar: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000, guid: d43b9052abbcc984bafbb1cc011790fa, type: 2}
|
||||
m_CullingMode: 0
|
||||
m_UpdateMode: 0
|
||||
m_ApplyRootMotion: 0
|
||||
m_LinearVelocityBlending: 0
|
||||
m_StabilizeFeet: 0
|
||||
m_WarningMessage:
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorStateOnDisable: 0
|
||||
m_WriteDefaultValuesOnDisable: 0
|
||||
--- !u!1 &5095248494043426006
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -2513,7 +2447,6 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 4255429133276147351}
|
||||
- component: {fileID: 9177278018785002683}
|
||||
- component: {fileID: 2010620652897398612}
|
||||
m_Layer: 0
|
||||
m_Name: Big
|
||||
m_TagString: Untagged
|
||||
|
|
@ -2588,27 +2521,6 @@ SpriteRenderer:
|
|||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!95 &2010620652897398612
|
||||
Animator:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6284485184760809741}
|
||||
m_Enabled: 1
|
||||
m_Avatar: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000, guid: d43b9052abbcc984bafbb1cc011790fa, type: 2}
|
||||
m_CullingMode: 0
|
||||
m_UpdateMode: 0
|
||||
m_ApplyRootMotion: 0
|
||||
m_LinearVelocityBlending: 0
|
||||
m_StabilizeFeet: 0
|
||||
m_WarningMessage:
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorStateOnDisable: 0
|
||||
m_WriteDefaultValuesOnDisable: 0
|
||||
--- !u!1 &6575509780232604342
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -3565,7 +3477,6 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 8638372891015524707}
|
||||
- component: {fileID: 18350484223611572}
|
||||
- component: {fileID: 8634187518571851645}
|
||||
m_Layer: 0
|
||||
m_Name: Small
|
||||
m_TagString: Untagged
|
||||
|
|
@ -3640,24 +3551,3 @@ SpriteRenderer:
|
|||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!95 &8634187518571851645
|
||||
Animator:
|
||||
serializedVersion: 5
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9071785972026254626}
|
||||
m_Enabled: 1
|
||||
m_Avatar: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000, guid: d43b9052abbcc984bafbb1cc011790fa, type: 2}
|
||||
m_CullingMode: 0
|
||||
m_UpdateMode: 0
|
||||
m_ApplyRootMotion: 0
|
||||
m_LinearVelocityBlending: 0
|
||||
m_StabilizeFeet: 0
|
||||
m_WarningMessage:
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorStateOnDisable: 0
|
||||
m_WriteDefaultValuesOnDisable: 0
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ AnimatorState:
|
|||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
m_WriteDefaultValues: 1
|
||||
m_WriteDefaultValues: 0
|
||||
m_Mirror: 0
|
||||
m_SpeedParameterActive: 0
|
||||
m_MirrorParameterActive: 0
|
||||
|
|
|
|||
|
|
@ -114,23 +114,19 @@ namespace HeavenStudio.Games.Loaders
|
|||
{
|
||||
function = delegate {
|
||||
var e = eventCaller.currentEntity;
|
||||
MeatGrinder.instance.Gears(e.beat, e.length, e["ease"], e["type"], e["speed"]);
|
||||
MeatGrinder.instance.ChangeGears(e.beat, e.length, e["ease"], e["speed"]);
|
||||
},
|
||||
resizable = true,
|
||||
defaultLength = 1,
|
||||
parameters = new List<Param>() {
|
||||
new Param("type", MeatGrinder.GearMode.Constant, "Ease", "What type of movement will the gears use?", new List<Param.CollapseParam>() {
|
||||
new((x, y) => (int)x != (int)MeatGrinder.GearMode.None, new string[] { "ease" }),
|
||||
}),
|
||||
new Param("speed", new EntityTypes.Float(0, 10, 1), "Speed", "How fast will the gears go?"),
|
||||
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "What ease will the gears speed up with?"),
|
||||
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "What ease will the gears speed up/slow down with?"),
|
||||
}
|
||||
},
|
||||
}
|
||||
// ,
|
||||
// new List<string>() { "pco", "normal", "repeat" },
|
||||
// "pcomeat", "en",
|
||||
// new List<string>() { }
|
||||
},
|
||||
new List<string>() { "pco", "normal", "repeat" },
|
||||
"pcomeat", "en",
|
||||
new List<string>() { }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -169,7 +165,7 @@ namespace HeavenStudio.Games
|
|||
}
|
||||
}
|
||||
|
||||
private static List<RiqEntity> queuedMeats = new();
|
||||
// private static List<RiqEntity> queuedMeats = new();
|
||||
|
||||
[Header("Objects")]
|
||||
public GameObject MeatBase;
|
||||
|
|
@ -179,7 +175,7 @@ namespace HeavenStudio.Games
|
|||
public Animator TackAnim;
|
||||
[SerializeField] Animator CartGuyParentAnim;
|
||||
[SerializeField] Animator CartGuyAnim;
|
||||
[SerializeField] Animator[] GearAnims;
|
||||
[SerializeField] Transform[] Gears;
|
||||
|
||||
[Header("Variables")]
|
||||
private bool bossBop = true;
|
||||
|
|
@ -188,9 +184,7 @@ namespace HeavenStudio.Games
|
|||
private bool cartPhone = false;
|
||||
private string cartDir = "Left";
|
||||
private UpdateEasing gearEase;
|
||||
private GearMode gearType = GearMode.Constant;
|
||||
private float oldGearSpeed = 1;
|
||||
private float currentGearSpeed = 1;
|
||||
private float newGearSpeed = 1;
|
||||
private const string sfxName = "meatGrinder/";
|
||||
|
||||
|
|
@ -217,13 +211,6 @@ namespace HeavenStudio.Games
|
|||
Left,
|
||||
}
|
||||
|
||||
public enum GearMode
|
||||
{
|
||||
None,
|
||||
Constant,
|
||||
Beat,
|
||||
}
|
||||
|
||||
protected static bool IA_PadAny(out double dt)
|
||||
{
|
||||
return PlayerInput.GetPadDown(InputController.ActionsPad.East, out dt)
|
||||
|
|
@ -246,6 +233,7 @@ namespace HeavenStudio.Games
|
|||
|
||||
private void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
if (PlayerInput.GetIsAction(InputAction_Press) && !IsExpectingInputNow(InputAction_Press))
|
||||
{
|
||||
TackAnim.DoScaledAnimationAsync("TackEmptyHit", 0.5f);
|
||||
|
|
@ -265,20 +253,24 @@ namespace HeavenStudio.Games
|
|||
passedTurns.Clear();
|
||||
}
|
||||
|
||||
var currentGearSpeed = newGearSpeed;
|
||||
if (gearEase.length != 0)
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(gearEase.beat, gearEase.length);
|
||||
float normalizedBeat = cond.GetPositionFromBeat(gearEase.beat, gearEase.length);
|
||||
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(gearEase.ease);
|
||||
currentGearSpeed = func(oldGearSpeed, newGearSpeed, normalizedBeat);
|
||||
Debug.Log(currentGearSpeed);
|
||||
if (normalizedBeat >= 1) cartEase.length = 0;
|
||||
}
|
||||
foreach (Transform gear in Gears)
|
||||
{
|
||||
double newZ = Time.deltaTime * currentGearSpeed * 50 * (gear.name == "Big" ? -1 : 1) / cond.pitchedSecPerBeat;
|
||||
gear.Rotate(new Vector3(0, 0, (float)newZ));
|
||||
}
|
||||
|
||||
if (cartEase.length != 0)
|
||||
{
|
||||
// CartGuyParentAnim.gameObject.SetActive(true);
|
||||
if (cartPhone) CartGuyAnim.Play("Phone", 0, 0);
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(cartEase.beat, cartEase.length);
|
||||
float normalizedBeat = cond.GetPositionFromBeat(cartEase.beat, cartEase.length);
|
||||
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(cartEase.ease);
|
||||
float newPos = func(0f, 1f, normalizedBeat);
|
||||
CartGuyParentAnim.DoNormalizedAnimation($"Move{cartDir}", newPos);
|
||||
|
|
@ -286,10 +278,6 @@ namespace HeavenStudio.Games
|
|||
}
|
||||
|
||||
CartGuyParentAnim.gameObject.SetActive(cartEase.length != 0);
|
||||
|
||||
if (gearType != GearMode.Beat) {
|
||||
UpdateGears();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnLateBeatPulse(double beat)
|
||||
|
|
@ -303,22 +291,6 @@ namespace HeavenStudio.Games
|
|||
Debug.Log(cartPhone ? "PhoneBop" : "Bop");
|
||||
CartGuyAnim.DoScaledAnimationAsync(cartPhone ? "PhoneBop" : "Bop", 0.5f);
|
||||
}
|
||||
|
||||
if (gearType == GearMode.Beat) {
|
||||
UpdateGears();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateGears()
|
||||
{
|
||||
Action<Animator> action = gearType switch {
|
||||
GearMode.Constant => gear => gear.DoNormalizedAnimation(gear.gameObject.name == "Small" ? "SpinForeverLeft" : "SpinForeverRight", (Conductor.instance.songPositionInBeats / (10 * newGearSpeed)) % 1),
|
||||
GearMode.Beat => gear => gear.DoScaledAnimationAsync(gear.gameObject.name == "Small" ? "SpinOnceLeft" : "SpinOnceRight", 0.5f),
|
||||
_ => gear => gear.Play("Nothing", 0, 0), // GearMode.None
|
||||
};
|
||||
foreach (Animator gear in GearAnims) {
|
||||
action.Invoke(gear);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnGameSwitch(double beat)
|
||||
|
|
@ -328,21 +300,29 @@ namespace HeavenStudio.Games
|
|||
foreach (var interval in queuedIntervals) StartInterval(interval.beat, interval.length, beat, interval.autoPassTurn);
|
||||
queuedIntervals.Clear();
|
||||
}
|
||||
if (queuedMeats.Count > 0)
|
||||
{
|
||||
foreach (var meat in queuedMeats) MeatToss(meat.beat, meat["bacon"], meat["tackReaction"], meat["tackReactionBeats"], meat["bossReaction"], meat["bossReactionBeats"]);
|
||||
queuedMeats.Clear();
|
||||
}
|
||||
// if (queuedMeats.Count > 0)
|
||||
// {
|
||||
// foreach (var meat in queuedMeats) MeatToss(meat.beat, meat["bacon"], meat["tackReaction"], meat["tackReactionBeats"], meat["bossReaction"], meat["bossReactionBeats"]);
|
||||
// queuedMeats.Clear();
|
||||
// }
|
||||
OnPlay(beat);
|
||||
}
|
||||
|
||||
public override void OnPlay(double beat)
|
||||
{
|
||||
RiqEntity cg = GameManager.instance.Beatmap.Entities.Find(c => c.datamodel == "meatGrinder/cartGuy");
|
||||
if (cg != null)
|
||||
{
|
||||
List<RiqEntity> allEntities = GameManager.instance.Beatmap.Entities.FindAll(c => c.datamodel[.."meatGrinder".Length] == "meatGrinder");
|
||||
RiqEntity cg = allEntities.Find(c => c.datamodel == "meatGrinder/cartGuy");
|
||||
if (cg != null) {
|
||||
CartGuy(cg.beat, cg.length, cg["spider"], cg["direction"], cg["ease"]);
|
||||
}
|
||||
RiqEntity gr = allEntities.Find(c => c.datamodel == "meatGrinder/gears");
|
||||
if (gr != null) {
|
||||
ChangeGears(gr.beat, gr.length, gr["ease"], gr["speed"]);
|
||||
}
|
||||
List<RiqEntity> meats = allEntities.FindAll(c => c.datamodel == "meatGrinder/MeatToss" && beat > c.beat && beat < c.beat + 1);
|
||||
foreach (var meat in meats) {
|
||||
MeatToss(meat.beat, meat["bacon"], meat["tackReaction"], meat["tackReactionBeats"], meat["bossReaction"], meat["bossReactionBeats"]);
|
||||
}
|
||||
}
|
||||
|
||||
private List<RiqEntity> GetRelevantMeatCallsBetweenBeat(double beat, double endBeat)
|
||||
|
|
@ -391,14 +371,13 @@ namespace HeavenStudio.Games
|
|||
cartDir = direction == 0 ? "Right" : "Left";
|
||||
}
|
||||
|
||||
public void Gears(double beat, float length, int ease, int type, float speed)
|
||||
public void ChangeGears(double beat, float length, int ease, float speed)
|
||||
{
|
||||
gearEase = new() {
|
||||
beat = beat,
|
||||
length = length,
|
||||
ease = (Util.EasingFunction.Ease)ease,
|
||||
};
|
||||
gearType = (GearMode)type;
|
||||
|
||||
oldGearSpeed = newGearSpeed;
|
||||
newGearSpeed = speed;
|
||||
|
|
@ -455,7 +434,7 @@ namespace HeavenStudio.Games
|
|||
|
||||
public static void QueueMeatToss(RiqEntity entity)
|
||||
{
|
||||
queuedMeats.Add(entity);
|
||||
// queuedMeats.Add(entity);
|
||||
}
|
||||
|
||||
public void MeatToss(double beat, bool bacon, int tackReaction, float tackReactionBeats, int bossReaction, float bossReactionBeats)
|
||||
|
|
|
|||
Loading…
Reference in a new issue