mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-23 18:15:13 +00:00
Trick on the Class: basic gameplay with placeholders
This commit is contained in:
parent
c3ef726ef8
commit
27dd45148e
3 changed files with 107 additions and 114 deletions
|
@ -781,7 +781,6 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 5439422992278930630}
|
||||
- {fileID: 2780804119974513822}
|
||||
- {fileID: 1069146004922609395}
|
||||
m_Father: {fileID: 1420343226113066666}
|
||||
m_RootOrder: 0
|
||||
|
@ -975,7 +974,7 @@ Transform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1864634399468090613}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &3081662997412186728
|
||||
MonoBehaviour:
|
||||
|
@ -1199,7 +1198,6 @@ Transform:
|
|||
m_Children:
|
||||
- {fileID: 3220906626812029788}
|
||||
- {fileID: 2526216985021064235}
|
||||
- {fileID: 2056721762869688494}
|
||||
m_Father: {fileID: 1420343226113066666}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
@ -1222,7 +1220,6 @@ MonoBehaviour:
|
|||
keyPoints:
|
||||
- {fileID: 782201934988699089}
|
||||
- {fileID: 3988407483934355435}
|
||||
- {fileID: 4991658420332302398}
|
||||
normalizedTime: 0.5
|
||||
--- !u!1 &4776077577780194085
|
||||
GameObject:
|
||||
|
@ -1384,55 +1381,8 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
curve: {fileID: 5261772982309671256}
|
||||
handleType: 0
|
||||
leftHandleLocalPosition: {x: 0.035689116, y: -0.13703394, z: -0.06739807}
|
||||
rightHandleLocalPosition: {x: -0.035689116, y: 0.13703394, z: 0.06739807}
|
||||
--- !u!1 &5312622210180036379
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2056721762869688494}
|
||||
- component: {fileID: 4991658420332302398}
|
||||
m_Layer: 0
|
||||
m_Name: Point 2
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &2056721762869688494
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5312622210180036379}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0.21, y: -6.44, z: 6.04}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 2805817892094278801}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &4991658420332302398
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5312622210180036379}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
curve: {fileID: 5261772982309671256}
|
||||
handleType: 0
|
||||
leftHandleLocalPosition: {x: 0.3903904, y: 1.3103101, z: -0.5020776}
|
||||
rightHandleLocalPosition: {x: -0.3903904, y: -1.3103101, z: 0.5020776}
|
||||
leftHandleLocalPosition: {x: 0.3305273, y: 3.2151892, z: -0.8895936}
|
||||
rightHandleLocalPosition: {x: -0.3305273, y: -3.2151892, z: 0.8895936}
|
||||
--- !u!1 &5360420740636381101
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1586,6 +1536,7 @@ MonoBehaviour:
|
|||
triggersAutoplay: 1
|
||||
flyType: 0
|
||||
startBeat: 0
|
||||
type: 0
|
||||
--- !u!1 &6218864461676157707
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1898,53 +1849,6 @@ SpriteRenderer:
|
|||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &7134327204225962626
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2780804119974513822}
|
||||
- component: {fileID: 5994471546180740026}
|
||||
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 &2780804119974513822
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7134327204225962626}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 3.935, y: 1.9329151, z: 0.337}
|
||||
m_LocalScale: {x: 1.0810812, y: 1.0810812, z: 1.0810812}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1864634399468090613}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &5994471546180740026
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7134327204225962626}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b0cca3244f403c24f819a870f31cdc29, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
curve: {fileID: 2490850543769942420}
|
||||
handleType: 0
|
||||
leftHandleLocalPosition: {x: -0.43804547, y: 0.1830787, z: 0.35531366}
|
||||
rightHandleLocalPosition: {x: 0.43804547, y: -0.1830787, z: -0.35531366}
|
||||
--- !u!1 &7208854294000353610
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -2054,6 +1958,7 @@ MonoBehaviour:
|
|||
triggersAutoplay: 1
|
||||
flyType: 0
|
||||
startBeat: 0
|
||||
type: 0
|
||||
--- !u!1 &7310611812045732801
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -2502,8 +2407,8 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
curve: {fileID: 5261772982309671256}
|
||||
handleType: 0
|
||||
leftHandleLocalPosition: {x: 2.1532657, y: -1.0266687, z: -1.4108837}
|
||||
rightHandleLocalPosition: {x: -2.1532657, y: 1.0266687, z: 1.4108837}
|
||||
leftHandleLocalPosition: {x: 2.309286, y: -0.7468654, z: -1.9092816}
|
||||
rightHandleLocalPosition: {x: -2.309286, y: 0.7468654, z: 1.9092816}
|
||||
--- !u!1 &8653118620308232900
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -13,8 +13,12 @@ namespace HeavenStudio.Games.Scripts_TrickClass
|
|||
public bool flyType;
|
||||
public float startBeat;
|
||||
bool flying = true;
|
||||
bool hit = false;
|
||||
bool miss = false;
|
||||
|
||||
float flyBeats;
|
||||
float dodgeBeats;
|
||||
public int type;
|
||||
|
||||
[NonSerialized] public BezierCurve3D curve;
|
||||
|
||||
|
@ -24,6 +28,7 @@ namespace HeavenStudio.Games.Scripts_TrickClass
|
|||
{
|
||||
game = TrickClass.instance;
|
||||
flyBeats = flyType ? 4f : 2f;
|
||||
dodgeBeats = flyType ? 2f : 1f;
|
||||
|
||||
var cond = Conductor.instance;
|
||||
|
||||
|
@ -39,27 +44,95 @@ namespace HeavenStudio.Games.Scripts_TrickClass
|
|||
var cond = Conductor.instance;
|
||||
|
||||
float flyPos = cond.GetPositionFromBeat(startBeat, flyBeats);
|
||||
Vector3 lastPos = transform.position;
|
||||
Vector3 nextPos = curve.GetPoint(flyPos);
|
||||
|
||||
if (flyType)
|
||||
if (flyPos <= 1f)
|
||||
{
|
||||
Vector3 direction = (nextPos - lastPos).normalized;
|
||||
float rotation = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
|
||||
this.transform.eulerAngles = new Vector3(0, 0, rotation);
|
||||
if (!miss)
|
||||
{
|
||||
flyPos *= 0.9f;
|
||||
}
|
||||
Vector3 lastPos = transform.position;
|
||||
Vector3 nextPos = curve.GetPoint(flyPos);
|
||||
|
||||
if (flyType)
|
||||
{
|
||||
Vector3 direction = (nextPos - lastPos).normalized;
|
||||
float rotation = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
|
||||
this.transform.eulerAngles = new Vector3(0, 0, rotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (360f * Time.deltaTime));
|
||||
}
|
||||
|
||||
transform.position = nextPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (360f * Time.deltaTime));
|
||||
transform.position = curve.GetPoint(1f);
|
||||
}
|
||||
|
||||
transform.position = nextPos;
|
||||
|
||||
if (flyPos > 1f)
|
||||
{
|
||||
GameObject.Destroy(gameObject);
|
||||
return;
|
||||
if (Conductor.instance.GetPositionFromBeat(startBeat, flyBeats + 1f) >= 1f)
|
||||
{
|
||||
GameObject.Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(hit || miss))
|
||||
{
|
||||
float normalizedBeat = cond.GetPositionFromMargin(startBeat + dodgeBeats, 1f);
|
||||
StateCheck(normalizedBeat);
|
||||
|
||||
if (PlayerInput.Pressed())
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
hit = true;
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("trickClass/ball_impact", startBeat + flyBeats, volume: 0.75f),
|
||||
});
|
||||
}
|
||||
}
|
||||
// no input?
|
||||
if (Conductor.instance.GetPositionFromBeat(startBeat, dodgeBeats) >= Minigame.EndTime())
|
||||
{
|
||||
PlayDodgeSound();
|
||||
miss = true;
|
||||
switch (type)
|
||||
{
|
||||
case (int) TrickClass.TrickObjType.Plane:
|
||||
curve = TrickClass.instance.planeMissCurve;
|
||||
flyBeats = 4f;
|
||||
break;
|
||||
default:
|
||||
curve = TrickClass.instance.ballMissCurve;
|
||||
flyBeats = 1.5f;
|
||||
break;
|
||||
}
|
||||
startBeat += dodgeBeats;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
{
|
||||
TrickClass.instance.PlayerDodge();
|
||||
hit = true;
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("trickClass/ball_impact", startBeat + flyBeats, volume: 0.5f),
|
||||
});
|
||||
}
|
||||
|
||||
public void PlayDodgeSound()
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
Jukebox.PlayOneShotGame("trickClass/ball_impact");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,14 @@ namespace HeavenStudio.Games
|
|||
instance = this;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (PlayerInput.Pressed())
|
||||
{
|
||||
PlayerDodge();
|
||||
}
|
||||
}
|
||||
|
||||
public void TossObject(float beat, int type)
|
||||
{
|
||||
switch (type)
|
||||
|
@ -80,8 +88,15 @@ namespace HeavenStudio.Games
|
|||
thinker.startBeat = beat;
|
||||
thinker.flyType = isPlane;
|
||||
thinker.curve = curve;
|
||||
thinker.type = type;
|
||||
|
||||
mobj.SetActive(true);
|
||||
}
|
||||
|
||||
public void PlayerDodge()
|
||||
{
|
||||
//anim
|
||||
Jukebox.PlayOneShotGame("trickClass/player_dodge");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue