wow i love super curves

This commit is contained in:
Rapandrasmus 2023-12-29 22:56:18 +01:00
parent 80961f7137
commit c4903e6e94
8 changed files with 325 additions and 98 deletions

View file

@ -10,6 +10,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 2892683027369623692} - component: {fileID: 2892683027369623692}
- component: {fileID: 2815389981742228673} - component: {fileID: 2815389981742228673}
- component: {fileID: 8443481187504185674}
m_Layer: 0 m_Layer: 0
m_Name: Totem m_Name: Totem
m_TagString: Untagged m_TagString: Untagged
@ -30,6 +31,7 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 3917273245613829895} - {fileID: 3917273245613829895}
- {fileID: 1227221646529388456}
m_Father: {fileID: 7191680920108009852} m_Father: {fileID: 7191680920108009852}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -54,6 +56,20 @@ Animator:
m_AllowConstantClipSamplingOptimization: 1 m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0 m_KeepAnimatorStateOnDisable: 0
m_WriteDefaultValuesOnDisable: 0 m_WriteDefaultValuesOnDisable: 0
--- !u!114 &8443481187504185674
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 38450379669086592}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 494645cb1b3cdeb418bae2a7e19fd269, type: 3}
m_Name:
m_EditorClassIdentifier:
_anim: {fileID: 2815389981742228673}
_jumperPoint: {fileID: 1227221646529388456}
--- !u!1 &235521313088006376 --- !u!1 &235521313088006376
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -147,6 +163,7 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 5749667637740173319} - component: {fileID: 5749667637740173319}
- component: {fileID: 9066120161103407552}
m_Layer: 0 m_Layer: 0
m_Name: Frog m_Name: Frog
m_TagString: Untagged m_TagString: Untagged
@ -169,9 +186,30 @@ Transform:
- {fileID: 2653965045326994221} - {fileID: 2653965045326994221}
- {fileID: 5838631045631306173} - {fileID: 5838631045631306173}
- {fileID: 3697837675551645759} - {fileID: 3697837675551645759}
- {fileID: 644641883719781763}
- {fileID: 7994465469293337682}
- {fileID: 2412478017021253490}
m_Father: {fileID: 7191680920108009852} m_Father: {fileID: 7191680920108009852}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &9066120161103407552
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 240329862653316689}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81963aa088010e041935d18a5b18a894, type: 3}
m_Name:
m_EditorClassIdentifier:
_animLeft: {fileID: 0}
_animMiddle: {fileID: 0}
_animRight: {fileID: 0}
_jumperPointLeft: {fileID: 644641883719781763}
_jumperPointMiddle: {fileID: 7994465469293337682}
_jumperPointRight: {fileID: 2412478017021253490}
--- !u!1 &516513247633929993 --- !u!1 &516513247633929993
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -424,6 +462,37 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!1 &1913468920525453536
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7302560279692477592}
m_Layer: 0
m_Name: InitialJumperPoint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7302560279692477592
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1913468920525453536}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -5.047, y: -0.96, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7036195930893080952}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2151449329910671277 --- !u!1 &2151449329910671277
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -883,6 +952,37 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!1 &4385750826297040385
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 644641883719781763}
m_Layer: 0
m_Name: JumperPointLeft
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &644641883719781763
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4385750826297040385}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.016, y: 2.876, z: 0}
m_LocalScale: {x: 0.47, y: 0.47, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5749667637740173319}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4502272174193327929 --- !u!1 &4502272174193327929
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1052,6 +1152,7 @@ Transform:
- {fileID: 6499924889799669646} - {fileID: 6499924889799669646}
- {fileID: 7191680920108009852} - {fileID: 7191680920108009852}
- {fileID: 1298493099490371972} - {fileID: 1298493099490371972}
- {fileID: 7302560279692477592}
m_Father: {fileID: 6484058324431055017} m_Father: {fileID: 6484058324431055017}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -1139,6 +1240,37 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!1 &5197615123340174885
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1227221646529388456}
m_Layer: 0
m_Name: JumperPoint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1227221646529388456
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5197615123340174885}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.036, y: 2.869, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2892683027369623692}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &5221338269682962569 --- !u!1 &5221338269682962569
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1559,6 +1691,37 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!1 &6119658906719982797
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2412478017021253490}
m_Layer: 0
m_Name: JumperPointRight
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2412478017021253490
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6119658906719982797}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 4.26, y: 4.05, z: 0}
m_LocalScale: {x: 0.47, y: 0.47, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5749667637740173319}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &6198288715119681818 --- !u!1 &6198288715119681818
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1643,6 +1806,37 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!1 &7211632521784862679
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7994465469293337682}
m_Layer: 0
m_Name: JumperPointMiddle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7994465469293337682
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7211632521784862679}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 2.112, y: 3.369, z: 0}
m_LocalScale: {x: 0.47, y: 0.47, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5749667637740173319}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7275193936285157507 --- !u!1 &7275193936285157507
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2212,11 +2406,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
offset: {x: 0, y: 0, z: 0} offset: {x: 0, y: 0, z: 0}
_jumpDistanceX: 3.838 _initialPoint: {fileID: 7302560279692477592}
_jumpDistanceY: 1.45
_jumpDistanceSmallX: 1.919
_jumpDistanceSmallY: 0.725
_jumpOffsetY: 0.1
_jumpHeight: 2 _jumpHeight: 2
--- !u!95 &7450811870195608846 --- !u!95 &7450811870195608846
Animator: Animator:

View file

@ -0,0 +1,26 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace HeavenStudio.Games.Scripts_TotemClimb
{
public class TCFrog : MonoBehaviour
{
[NonSerialized] public double beat;
[SerializeField] private Animator _animLeft;
[SerializeField] private Animator _animMiddle;
[SerializeField] private Animator _animRight;
[SerializeField] private Transform _jumperPointLeft;
[SerializeField] private Transform _jumperPointMiddle;
[SerializeField] private Transform _jumperPointRight;
public Transform JumperPointLeft => _jumperPointLeft;
public Transform JumperPointMiddle => _jumperPointMiddle;
public Transform JumperPointRight => _jumperPointRight;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 81963aa088010e041935d18a5b18a894
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -8,49 +8,44 @@ namespace HeavenStudio.Games.Scripts_TotemClimb
{ {
public class TCJumper : SuperCurveObject public class TCJumper : SuperCurveObject
{ {
[SerializeField] private float _jumpDistanceX; [SerializeField] private Transform _initialPoint;
[SerializeField] private float _jumpDistanceY;
[SerializeField] private float _jumpDistanceSmallX;
[SerializeField] private float _jumpDistanceSmallY;
[SerializeField] private float _jumpOffsetY;
[SerializeField] private float _jumpHeight = 2f; [SerializeField] private float _jumpHeight = 2f;
private Path _path; private Path _path;
private Animator _anim; private Animator _anim;
private TotemClimb _game; private TotemClimb _game;
private double _startBeat;
private void Awake() private void Awake()
{ {
_anim = GetComponent<Animator>(); _anim = GetComponent<Animator>();
_game = TotemClimb.instance; _game = TotemClimb.instance;
}
public void InitPath(double beat)
{
_startBeat = beat;
_path = new Path(); _path = new Path();
_path.positions = new PathPos[2]; _path.positions = new PathPos[2];
_path.positions[0] = new PathPos() _path.positions[0] = new PathPos()
{ {
duration = 1, duration = 1 - (float)Conductor.instance.SecsToBeats(Minigame.justEarlyTime, Conductor.instance.GetBpmAtBeat(beat)),
pos = new(transform.localPosition.x, transform.localPosition.y), target = _initialPoint,
height = _jumpHeight height = _jumpHeight
}; };
_path.positions[1] = new PathPos() _path.positions[1] = new PathPos()
{ {
pos = new(transform.localPosition.x + _jumpDistanceX, transform.localPosition.y + _jumpDistanceY + _jumpOffsetY) target = _game.GetJumperPointAtBeat(beat)
}; };
} }
public void StartJumping(double beat, bool inTriple = false) public void StartJumping(double beat)
{ {
bool nextIsTriple = _game.IsTripleBeat(beat + 1); bool nextIsTriple = _game.IsTripleBeat(beat + 1);
StartCoroutine(JumpCo(beat, 1f, nextIsTriple && !inTriple)); StartCoroutine(JumpCo(beat));
if (beat + 1 >= _game.EndBeat) return; if (beat + 1 >= _game.EndBeat) return;
_game.ScheduleInput(beat, 1, Minigame.InputAction_BasicPress, nextIsTriple ? JustTripleEnter : Just, nextIsTriple ? MissTripleEnter : Miss, Empty); _game.ScheduleInput(beat, 1, Minigame.InputAction_BasicPress, Just, Miss, Empty);
}
public void StartTripleJumping(double beat, bool exit)
{
StartCoroutine(JumpCo(beat, 0.5f, true));
if (beat + 0.5 >= _game.EndBeat) return;
_game.ScheduleInput(beat, 0.5, Minigame.InputAction_BasicPress, exit ? Just : JustTripleExit, exit ? Miss : MissTripleExit, Empty);
} }
public void Bop() public void Bop()
@ -58,9 +53,23 @@ namespace HeavenStudio.Games.Scripts_TotemClimb
_anim.DoScaledAnimationAsync("Bop", 0.5f); _anim.DoScaledAnimationAsync("Bop", 0.5f);
} }
private IEnumerator JumpCo(double beat, float length = 1f, bool small = false) private IEnumerator JumpCo(double beat)
{ {
_path.positions[0].duration = length - (float)Conductor.instance.SecsToBeats(Minigame.justEarlyTime, Conductor.instance.GetBpmAtBeat(beat + length)); if (beat >= _startBeat)
{
_path = new Path();
_path.positions = new PathPos[2];
_path.positions[0] = new PathPos()
{
duration = 1 - (float)Conductor.instance.SecsToBeats(Minigame.justEarlyTime, Conductor.instance.GetBpmAtBeat(beat + 1)),
height = _jumpHeight,
target = _game.GetJumperPointAtBeat(beat)
};
_path.positions[1] = new PathPos()
{
target = _game.GetJumperPointAtBeat(beat + 1)
};
}
_anim.Play("Jump", 0, 0); _anim.Play("Jump", 0, 0);
float normalizedBeat = Conductor.instance.GetPositionFromBeat(beat, _path.positions[0].duration); float normalizedBeat = Conductor.instance.GetPositionFromBeat(beat, _path.positions[0].duration);
@ -68,7 +77,7 @@ namespace HeavenStudio.Games.Scripts_TotemClimb
while(normalizedBeat < 1f) while(normalizedBeat < 1f)
{ {
transform.localPosition = GetPathPositionFromBeat(_path, Math.Min(Conductor.instance.songPositionInBeatsAsDouble, beat + _path.positions[0].duration), beat); transform.position = GetPathPositionFromBeat(_path, Math.Min(Conductor.instance.songPositionInBeatsAsDouble, beat + _path.positions[0].duration), beat);
if (normalizedBeat >= 0.5f && !playedFall) if (normalizedBeat >= 0.5f && !playedFall)
{ {
@ -79,15 +88,13 @@ namespace HeavenStudio.Games.Scripts_TotemClimb
normalizedBeat = Conductor.instance.GetPositionFromBeat(beat, _path.positions[0].duration); normalizedBeat = Conductor.instance.GetPositionFromBeat(beat, _path.positions[0].duration);
yield return null; yield return null;
} }
_path.positions[0].pos += small ? new Vector3(_jumpDistanceSmallX, _jumpDistanceSmallY) : new Vector3(_jumpDistanceX, _jumpDistanceY);
_path.positions[1].pos += small ? new Vector3(_jumpDistanceSmallX, _jumpDistanceSmallY) : new Vector3(_jumpDistanceX, _jumpDistanceY);
_anim.Play("Idle", 0, 0); _anim.Play("Idle", 0, 0);
} }
private void Just(PlayerActionEvent caller, float state) private void Just(PlayerActionEvent caller, float state)
{ {
bool isTriple = _game.IsTripleBeat(caller.startBeat + caller.timer); bool isTriple = _game.IsTripleBeat(caller.startBeat + caller.timer);
StartJumping(caller.startBeat + caller.timer, isTriple); StartJumping(caller.startBeat + caller.timer);
_game.BopTotemAtBeat(caller.startBeat + caller.timer); _game.BopTotemAtBeat(caller.startBeat + caller.timer);
if (state >= 1f || state <= -1f) if (state >= 1f || state <= -1f)
{ {
@ -96,42 +103,12 @@ namespace HeavenStudio.Games.Scripts_TotemClimb
SoundByte.PlayOneShotGame(isTriple ? "totemClimb/totemlandb" : "totemClimb/totemland"); SoundByte.PlayOneShotGame(isTriple ? "totemClimb/totemlandb" : "totemClimb/totemland");
} }
private void JustTripleEnter(PlayerActionEvent caller, float state)
{
StartTripleJumping(caller.startBeat + caller.timer, false);
if (state >= 1f || state <= -1f)
{
return;
}
SoundByte.PlayOneShotGame("totemClimb/totemland");
}
private void JustTripleExit(PlayerActionEvent caller, float state)
{
StartTripleJumping(caller.startBeat + caller.timer, true);
if (state >= 1f || state <= -1f)
{
return;
}
SoundByte.PlayOneShotGame("totemClimb/totemland");
}
private void Miss(PlayerActionEvent caller) private void Miss(PlayerActionEvent caller)
{ {
StartJumping(caller.startBeat + caller.timer); StartJumping(caller.startBeat + caller.timer);
_game.BopTotemAtBeat(caller.startBeat + caller.timer); _game.BopTotemAtBeat(caller.startBeat + caller.timer);
} }
private void MissTripleEnter(PlayerActionEvent caller)
{
StartTripleJumping(caller.startBeat + caller.timer, false);
}
private void MissTripleExit(PlayerActionEvent caller)
{
StartTripleJumping(caller.startBeat + caller.timer, true);
}
private void Empty(PlayerActionEvent caller) { } private void Empty(PlayerActionEvent caller) { }
} }
} }

View file

@ -0,0 +1,22 @@
using HeavenStudio.Util;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace HeavenStudio.Games.Scripts_TotemClimb
{
public class TCTotem : MonoBehaviour
{
[NonSerialized] public double beat;
[SerializeField] private Animator _anim;
[SerializeField] private Transform _jumperPoint;
public Transform JumperPoint => _jumperPoint;
public void Bop()
{
_anim.DoScaledAnimationAsync("Bop", 0.5f);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 494645cb1b3cdeb418bae2a7e19fd269
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -16,42 +16,12 @@ namespace HeavenStudio.Games.Scripts_TotemClimb
private Transform _scrollTransform; private Transform _scrollTransform;
private float _totemStartX; private float _totemStartX;
private float _totemStartY; private float _totemStartY;
private List<Totem> _totems = new(); private List<TCTotem> _totems = new();
private List<Frog> _frogs = new(); private List<TCFrog> _frogs = new();
private int _totemIndex = 0; private int _totemIndex = 0;
private TotemClimb _game; private TotemClimb _game;
private class Totem
{
public double beat;
public Transform transform;
public Animator anim;
public Totem(Transform mTransform, Animator mAnim, double mBeat = 0)
{
transform = mTransform;
anim = mAnim;
beat = mBeat;
}
}
private class Frog
{
public double beat;
public Transform transform;
public Animator anim, anim1, anim2;
public Frog(Transform mTransform, Animator mAnim, Animator mAnim1, Animator mAnim2, double mBeat)
{
transform = mTransform;
anim = mAnim;
anim1 = mAnim1;
anim2 = mAnim2;
beat = mBeat;
}
}
private void Awake() private void Awake()
{ {
_game = TotemClimb.instance; _game = TotemClimb.instance;
@ -59,13 +29,13 @@ namespace HeavenStudio.Games.Scripts_TotemClimb
_totemStartX = _totemTransform.localPosition.x; _totemStartX = _totemTransform.localPosition.x;
_totemStartY = _totemTransform.localPosition.y; _totemStartY = _totemTransform.localPosition.y;
_totems.Add(new(_totemTransform, _totemTransform.GetComponent<Animator>())); _totems.Add(_totemTransform.GetComponent<TCTotem>());
for (int i = 1; i < _totemAmount; i++) for (int i = 1; i < _totemAmount; i++)
{ {
Transform spawnedTotem = Instantiate(_totemTransform, transform); Transform spawnedTotem = Instantiate(_totemTransform, transform);
spawnedTotem.transform.localPosition = new Vector3(_totemStartX + (_xDistance * i), _totemStartY + (_yDistance * i)); spawnedTotem.transform.localPosition = new Vector3(_totemStartX + (_xDistance * i), _totemStartY + (_yDistance * i));
_totems.Add(new(spawnedTotem, spawnedTotem.GetComponent<Animator>())); _totems.Add(spawnedTotem.GetComponent<TCTotem>());
} }
} }
@ -85,7 +55,8 @@ namespace HeavenStudio.Games.Scripts_TotemClimb
Transform spawnedFrog = Instantiate(_frogTransform, transform); Transform spawnedFrog = Instantiate(_frogTransform, transform);
spawnedFrog.transform.localPosition += new Vector3(_xDistance * (float)(beat - startBeat), _yDistance * (float)(beat - startBeat)); spawnedFrog.transform.localPosition += new Vector3(_xDistance * (float)(beat - startBeat), _yDistance * (float)(beat - startBeat));
spawnedFrog.gameObject.SetActive(true); spawnedFrog.gameObject.SetActive(true);
_frogs.Add(new Frog(spawnedFrog, null, null, null, beat)); _frogs.Add(spawnedFrog.GetComponent<TCFrog>());
_frogs[i].beat = beat;
} }
} }
} }
@ -95,7 +66,18 @@ namespace HeavenStudio.Games.Scripts_TotemClimb
var t = _totems.Find(x => x.beat == beat); var t = _totems.Find(x => x.beat == beat);
if (t == null) return; if (t == null) return;
t.anim.DoScaledAnimationAsync("Bop", 0.5f); t.Bop();
}
public Transform GetJumperPointAtBeat(double beat)
{
var t = _totems.Find(x => x.beat == beat);
if (t == null)
{
Debug.Log($"Jumper Point unavaible at beat {beat}.");
return null;
}
return t.JumperPoint;
} }
private void Update() private void Update()

View file

@ -73,6 +73,8 @@ namespace HeavenStudio.Games
CalculateStartAndEndBeat(beat); CalculateStartAndEndBeat(beat);
GetTripleEvents(); GetTripleEvents();
HandleBopsOnStart(beat); HandleBopsOnStart(beat);
_totemManager.InitBeats(_startBeat);
_jumper.InitPath(_startBeat);
} }
public override void OnPlay(double beat) public override void OnPlay(double beat)
@ -84,6 +86,8 @@ namespace HeavenStudio.Games
CalculateStartAndEndBeat(lastGameSwitchBeat); CalculateStartAndEndBeat(lastGameSwitchBeat);
GetTripleEvents(); GetTripleEvents();
HandleBopsOnStart(beat); HandleBopsOnStart(beat);
_totemManager.InitBeats(_startBeat);
_jumper.InitPath(_startBeat);
} }
private void CalculateStartAndEndBeat(double beat) private void CalculateStartAndEndBeat(double beat)
@ -139,7 +143,6 @@ namespace HeavenStudio.Games
} }
_tripleEvents = tempTriples; _tripleEvents = tempTriples;
_totemManager.InitBeats(_startBeat);
} }
private void Update() private void Update()
@ -154,6 +157,11 @@ namespace HeavenStudio.Games
_totemManager.BopTotemAtBeat(beat); _totemManager.BopTotemAtBeat(beat);
} }
public Transform GetJumperPointAtBeat(double beat)
{
return _totemManager.GetJumperPointAtBeat(beat);
}
public void Bop(double beat, float length, double callBeat) public void Bop(double beat, float length, double callBeat)
{ {
List<BeatAction.Action> actions = new(); List<BeatAction.Action> actions = new();