Add miss curve and Toggle Blocks

This commit is contained in:
fu-majime 2024-03-27 14:26:03 +09:00
parent 9bd567de2a
commit 8aa9585709
8 changed files with 277 additions and 63 deletions

View file

@ -34,7 +34,7 @@ Transform:
- {fileID: 7992821099441364994}
- {fileID: 1077284773372058207}
m_Father: {fileID: 8647730809244910814}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1233513900584617091
GameObject:
@ -214,7 +214,57 @@ MonoBehaviour:
- {fileID: 2403286260282178760}
- {fileID: 663361784237137429}
- {fileID: 2107336164975858084}
missCurve:
- {fileID: 5864016952948325823}
- {fileID: 926142239937072796}
--- !u!1 &2353135817496635902
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2318543150435041217}
- component: {fileID: 7995163640438374273}
m_Layer: 0
m_Name: Point 0
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2318543150435041217
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2353135817496635902}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.32439613, y: -0.69698596, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2322398828771687832}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &7995163640438374273
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2353135817496635902}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3}
m_Name:
m_EditorClassIdentifier:
curve: {fileID: 926142239937072796}
handleType: 0
leftHandleLocalPosition: {x: -0.73065376, y: -2.4536002, z: -0}
rightHandleLocalPosition: {x: 0.73065376, y: 2.4536002, z: 0}
--- !u!1 &2979763165916823418
GameObject:
m_ObjectHideFlags: 0
@ -826,6 +876,60 @@ Transform:
m_Father: {fileID: 7036960847367506643}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4469187681387395411
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2322398828771687832}
- component: {fileID: 926142239937072796}
m_Layer: 0
m_Name: misscurveFallRight
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2322398828771687832
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4469187681387395411}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 12, y: 4, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2318543150435041217}
- {fileID: 5350510116730758372}
m_Father: {fileID: 8261734455463571378}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &926142239937072796
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4469187681387395411}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 066a41e004f415b4eb74d5e61a2aadbe, type: 3}
m_Name:
m_EditorClassIdentifier:
curveColor: {r: 0, g: 1, b: 0, a: 1}
startPointColor: {r: 1, g: 0, b: 0, a: 1}
endPointColor: {r: 0, g: 0, b: 1, a: 1}
sampling: 25
keyPoints:
- {fileID: 7995163640438374273}
- {fileID: 85047129040768200}
normalizedTime: 0.5
--- !u!1 &4548868880561789436
GameObject:
m_ObjectHideFlags: 0
@ -837,7 +941,7 @@ GameObject:
- component: {fileID: 7740858569420169238}
- component: {fileID: 5864016952948325823}
m_Layer: 0
m_Name: misscurve
m_Name: misscurveFallLeft
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -857,8 +961,8 @@ Transform:
m_Children:
- {fileID: 6792788293978351115}
- {fileID: 2931808131501055453}
m_Father: {fileID: 6137499710566233010}
m_RootOrder: 9
m_Father: {fileID: 8261734455463571378}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &5864016952948325823
MonoBehaviour:
@ -905,7 +1009,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4670249678981668613}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.11793232, y: -1.1006966, z: 0}
m_LocalPosition: {x: -0.6, y: -0.73, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -1012,6 +1116,87 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &4996280687422381540
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8261734455463571378}
m_Layer: 0
m_Name: missCurve
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8261734455463571378
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4996280687422381540}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.0500001, y: 1.0500001, z: 1.0500001}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2322398828771687832}
- {fileID: 7740858569420169238}
m_Father: {fileID: 8647730809244910814}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &5576258121036808493
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5350510116730758372}
- component: {fileID: 85047129040768200}
m_Layer: 0
m_Name: Point 1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5350510116730758372
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5576258121036808493}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.5918388, y: -4.2095757, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2322398828771687832}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &85047129040768200
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5576258121036808493}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3}
m_Name:
m_EditorClassIdentifier:
curve: {fileID: 926142239937072796}
handleType: 0
leftHandleLocalPosition: {x: -0.290452, y: 3.2799375, z: 0}
rightHandleLocalPosition: {x: 0.290452, y: -3.2799375, z: -0}
--- !u!1 &6240414570932603033
GameObject:
m_ObjectHideFlags: 0
@ -1252,7 +1437,6 @@ Transform:
- {fileID: 816514540217425161}
- {fileID: 4693607598784070536}
- {fileID: 518983927004252684}
- {fileID: 7740858569420169238}
m_Father: {fileID: 8647730809244910814}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -1451,7 +1635,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6653269419284669817}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -1.1360111, y: -5.260124, z: 0}
m_LocalPosition: {x: -1.7, y: -5.2, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -1594,7 +1778,7 @@ Transform:
- {fileID: 7041548894936082627}
- {fileID: 1399441058465216569}
m_Father: {fileID: 8647730809244910814}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8062346391620078955
GameObject:
@ -1713,7 +1897,7 @@ Transform:
- {fileID: 3690873091745874876}
- {fileID: 2824569028783229965}
m_Father: {fileID: 8647730809244910814}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8410279922469575830
GameObject:
@ -1898,8 +2082,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
Squares: []
missAngle: -50
fallingAngle: 90
missAngle: -45
fallingAngle: 45
--- !u!95 &863865117502866643
Animator:
serializedVersion: 5
@ -1955,7 +2139,7 @@ Transform:
- {fileID: 4425734730169624220}
- {fileID: 726288490227069551}
m_Father: {fileID: 8647730809244910814}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &9035679448612522690
GameObject:
@ -1986,6 +2170,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6137499710566233010}
- {fileID: 8261734455463571378}
- {fileID: 8078835494031887749}
- {fileID: 1327125824545584460}
- {fileID: 487889569144872992}

View file

@ -491,7 +491,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
position: 0
_slideOffset: -10
_slideOffset: -5.4
--- !u!1 &1305944185207812440
GameObject:
m_ObjectHideFlags: 0
@ -2289,7 +2289,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 100
m_SortingOrder: 4
m_Sprite: {fileID: -838454829, guid: 7ae23457ecf2da644aea24383a448ff8, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0

View file

@ -343,9 +343,9 @@ AnimationClip:
- time: 0.033333335
value: {fileID: 356430700, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- time: 0.06666667
value: {fileID: 5231650026959507566, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
value: {fileID: 7197940218791003086, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- time: 0.1
value: {fileID: -4613643292913599761, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
value: {fileID: -5883628003128837853, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- time: 0.13333334
value: {fileID: 444922917, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- time: 0.2
@ -417,8 +417,8 @@ AnimationClip:
- {fileID: 956981337, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: -1667867877, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: 356430700, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: 5231650026959507566, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: -4613643292913599761, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: 7197940218791003086, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: -5883628003128837853, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: 444922917, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: -652921874, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: -1903993783, guid: f77716464d1f0864fbad93cdacd39630, type: 3}

View file

@ -273,9 +273,9 @@ AnimationClip:
- time: 0.16666667
value: {fileID: 444922917, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- time: 0.23333333
value: {fileID: -4613643292913599761, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
value: {fileID: -5883628003128837853, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- time: 0.33333334
value: {fileID: 5231650026959507566, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
value: {fileID: 7197940218791003086, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- time: 0.43333334
value: {fileID: -2012133994, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- time: 0.56666666
@ -342,8 +342,8 @@ AnimationClip:
- {fileID: -1903993783, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: -652921874, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: 444922917, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: -4613643292913599761, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: 5231650026959507566, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: -5883628003128837853, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: 7197940218791003086, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: -2012133994, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: 356430700, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: 356430700, guid: f77716464d1f0864fbad93cdacd39630, type: 3}

View file

@ -234,9 +234,9 @@ AnimationClip:
- time: 0.13333334
value: {fileID: 444922917, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- time: 0.16666667
value: {fileID: 4881183030622861663, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
value: {fileID: -5883628003128837853, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- time: 0.2
value: {fileID: -4190599202341174402, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
value: {fileID: 7197940218791003086, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- time: 0.23333333
value: {fileID: -2012133994, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- time: 0.26666668
@ -312,8 +312,8 @@ AnimationClip:
- {fileID: -1903993783, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: -652921874, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: 444922917, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: 4881183030622861663, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: -4190599202341174402, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: -5883628003128837853, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: 7197940218791003086, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: -2012133994, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: 356430700, guid: f77716464d1f0864fbad93cdacd39630, type: 3}
- {fileID: 956981337, guid: f77716464d1f0864fbad93cdacd39630, type: 3}

View file

@ -28,23 +28,19 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
private void Awake()
{
_thisPosition = transform.localPosition;
_otherPosition = _thisPosition + new Vector3(_slideOffset, 0);
_otherPosition = _thisPosition + new Vector3(0, _slideOffset);
game = BuiltToScaleRvl.instance;
blockAnim = GetComponent<Animator>();
if (!BuiltToScaleRvl.IsPositionInRange(position)) position = 0;
}
private void Update()
{
}
public void Move(double beat, double length, bool inToScene)
public void Move(double beat, double length, bool inToScene, int ease)
{
if (_currentMove != null) StopCoroutine(_currentMove);
_currentMove = StartCoroutine(MoveCo(beat, length, inToScene));
_currentMove = StartCoroutine(MoveCo(beat, length, inToScene, ease));
}
private IEnumerator MoveCo(double beat, double length, bool inToScene)
private IEnumerator MoveCo(double beat, double length, bool inToScene, int ease)
{
if (length <= 0)
{
@ -52,11 +48,12 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
yield break;
}
float normalized = Conductor.instance.GetPositionFromBeat(beat, length, false);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)ease);
while (normalized <= 1f)
{
normalized = Conductor.instance.GetPositionFromBeat(beat, length);
Vector3 newPos = Vector3.Lerp(inToScene ? _otherPosition : _thisPosition, inToScene ? _thisPosition : _otherPosition, normalized);
transform.localPosition = newPos;
float newPosY = func(inToScene ? _otherPosition.y : _thisPosition.y, inToScene ? _thisPosition.y : _otherPosition.y, normalized);
transform.localPosition = new Vector3(_thisPosition.x, newPosY, _thisPosition.z);
yield return null;
}
}

View file

@ -53,7 +53,7 @@ namespace HeavenStudio.Games.Loaders
parameters = new List<Param>()
{
new Param("direction", BuiltToScaleRvl.Direction.Left, "Direction", "Set the direction in which the rod will come out."),
new Param("target", BuiltToScaleRvl.TargetBox.First, "Target", "Set the target in which the rod will bounce."),
new Param("target", BuiltToScaleRvl.TargetBlock.First, "Target", "Set the target in which the rod will bounce."),
new Param("id", new EntityTypes.Integer(1, 4, 0), "Rod ID", "Set the ID of the rod to spawn. Rods with the same ID cannot spawn at the same time."),
},
},
@ -66,6 +66,21 @@ namespace HeavenStudio.Games.Loaders
new Param("id", new EntityTypes.Integer(1, 4, 0), "Rod ID", "Set the ID of the rod to bounce."),
},
},
new GameAction("presence", "Toggle Blocks")
{
function = delegate { var e = eventCaller.currentEntity; BuiltToScaleRvl.instance.ToggleBlocksPresence(e.beat, e.length, e["in"], e["ease"], e["first"], e["second"], e["third"], e["fourth"]); },
defaultLength = 2f,
resizable = true,
parameters = new List<Param>()
{
new Param("first", false, "First Block", "Toggle if this block should be animated."),
new Param("second", false, "Second Block", "Toggle if this block should be animated."),
new Param("third", false, "Third Block", "Toggle if this block should be animated."),
new Param("fourth", false, "Fourth Block", "Toggle if this block should be animated."),
new Param("in", false, "In / Out", "Toggle if blocks should be present."),
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action."),
}
},
}, new List<string>() { "rvl", "normal" }, "rvlbuilt", "en", new List<string>() { });
}
}
@ -95,7 +110,7 @@ namespace HeavenStudio.Games
Fourth,
OuterRight,
}
public enum TargetBox {
public enum TargetBlock {
First = 1,
Second,
Third,
@ -129,6 +144,7 @@ namespace HeavenStudio.Games
int widgetIndex;
public BezierCurve3D[] curve;
public BezierCurve3D[] missCurve;
public static readonly Dictionary<(int, int), int> curveMap = new Dictionary<(int, int), int> {
{(-1, 0), 0}, // 01 in
{(0, 1), 2}, {(1, 0), 2}, // 12
@ -217,10 +233,10 @@ namespace HeavenStudio.Games
break;
case "builtToScaleRvl/custom spawn":
nextPos = evt["target"] switch {
(int)TargetBox.First => 0,
(int)TargetBox.Second => 1,
(int)TargetBox.Third => 2,
(int)TargetBox.Fourth => 3,
(int)TargetBlock.First => 0,
(int)TargetBlock.Second => 1,
(int)TargetBlock.Third => 2,
(int)TargetBlock.Fourth => 3,
_ => throw new System.NotImplementedException()
};
break;
@ -481,6 +497,20 @@ namespace HeavenStudio.Games
blocks[position].Idle(beat);
}
public void ToggleBlocksPresence(double beat, double length, bool inToScene, int ease, bool first, bool second, bool third, bool fourth)
{
var blocks = new bool[] {first, second, third, fourth};
for (int i = 0; i < blocks.Length; i++) {
if (blocks[i]) ActivateBlockVisualPresence(beat, length, i, inToScene, ease);
}
}
private void ActivateBlockVisualPresence(double beat, double length, int position, bool inToScene, int ease)
{
if (!IsPositionInRange(position)) return;
blocks[position].Move(beat, length, inToScene, ease);
}
public static int getFollowingPos(int currentPos, int nextPos, int nextTime, CustomBounceItem[] bounceItems)
{
var bounce = Array.Find(bounceItems, x => x.time == nextTime);

View file

@ -32,6 +32,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
time = 0;
BounceRecursion(startBeat, lengthBeat, currentPos, nextPos);
setParameters(currentPos, nextPos);
fallingAngle = fallingAngle * UnityEngine.Random.Range(-1f, 1f);
}
void Update()
{
@ -139,31 +140,37 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
}
private void BounceOnMiss(PlayerActionEvent caller)
{
game.PlayBlockBounceMiss(nextPos);
BeatAction.New(game, new List<BeatAction.Action>() {new BeatAction.Action(currentBeat + 2*lengthBeat, delegate {
game.PlayBlockIdle(nextPos, currentBeat + 2*lengthBeat);
End();
})});
currentCurve = game.curve[^1]; // miss
currentBeat = Conductor.instance.songPositionInBeats;
rodAnim.SetFloat("speed", -1f);
isMiss = true;
Falling();
}
private bool CanBounceHit()
{
return !game.isPlayerOpen;
}
private void Falling()
{
int missCurveIndex = (currentPos > nextPos) ? 0 : 1;
currentCurve = game.missCurve[missCurveIndex];
currentBeat = Conductor.instance.songPositionInBeats;
rodAnim.SetFloat("speed", -1f);
isMiss = true;
game.PlayBlockBounceMiss(nextPos);
BeatAction.New(game, new List<BeatAction.Action>() {
new BeatAction.Action(currentBeat + lengthBeat*0.2f, delegate {
GetComponent<SpriteRenderer>().sortingOrder = 1;
}),
new BeatAction.Action(currentBeat + lengthBeat, delegate {
game.PlayBlockIdle(nextPos, currentBeat + lengthBeat);
End();
})
});
}
private void ShootOnHit(PlayerActionEvent caller, float state)
{
if (state >= 1f || state <= -1f)
{
currentCurve = game.curve[^1]; // miss
currentBeat = Conductor.instance.songPositionInBeats;
rodAnim.SetFloat("speed", -1f);
isMiss = true;
game.PlayBlockShootNearlyMiss(nextPos);
BeatAction.New(game, new List<BeatAction.Action>() {new BeatAction.Action(currentBeat + lengthBeat, () => End())});
Falling();
return;
}
@ -184,12 +191,7 @@ namespace HeavenStudio.Games.Scripts_BuiltToScaleRvl
}
else
{
currentCurve = game.curve[^1]; // miss
currentBeat = Conductor.instance.songPositionInBeats;
rodAnim.SetFloat("speed", -1f);
isMiss = true;
game.PlayBlockBounceMiss(nextPos);
BeatAction.New(game, new List<BeatAction.Action>() {new BeatAction.Action(currentBeat + lengthBeat, () => End())});
Falling();
}
}
private bool CanShootHit()