mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-23 18:15:13 +00:00
Coin Toss Functionnal (Needs Miss and Blank animation)
This commit is contained in:
parent
fdfcbe8948
commit
72b4ef1aeb
11 changed files with 175 additions and 86 deletions
|
@ -82,6 +82,62 @@ SpriteRenderer:
|
||||||
m_WasSpriteAssigned: 1
|
m_WasSpriteAssigned: 1
|
||||||
m_MaskInteraction: 0
|
m_MaskInteraction: 0
|
||||||
m_SpriteSortPoint: 0
|
m_SpriteSortPoint: 0
|
||||||
|
--- !u!1 &2284767481152605812
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 5807365695538841574}
|
||||||
|
- component: {fileID: 5502145621422939277}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: Coin_Cue
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 0
|
||||||
|
--- !u!4 &5807365695538841574
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2284767481152605812}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0.80453336, y: -2.6470656, z: -1.8526075}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 8906338938816874952}
|
||||||
|
m_RootOrder: 2
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &5502145621422939277
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2284767481152605812}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: df09de01a35532c42b315b9b076cf88b, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
inList: 0
|
||||||
|
lastState: 0
|
||||||
|
state:
|
||||||
|
gameObject: {fileID: 0}
|
||||||
|
early: 0
|
||||||
|
perfect: 0
|
||||||
|
late: 0
|
||||||
|
createBeat: 0
|
||||||
|
eligibleHitsList: []
|
||||||
|
aceTimes: 0
|
||||||
|
isEligible: 0
|
||||||
|
triggersAutoplay: 1
|
||||||
|
startBeat: 0
|
||||||
--- !u!1 &4255918877615705356
|
--- !u!1 &4255918877615705356
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -524,6 +580,7 @@ Transform:
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 5417053695332528972}
|
- {fileID: 5417053695332528972}
|
||||||
- {fileID: 3170172331476655201}
|
- {fileID: 3170172331476655201}
|
||||||
|
- {fileID: 5807365695538841574}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
@ -542,6 +599,7 @@ MonoBehaviour:
|
||||||
EligibleHits: []
|
EligibleHits: []
|
||||||
firstEnable: 0
|
firstEnable: 0
|
||||||
isThrowing: 0
|
isThrowing: 0
|
||||||
|
coin_cue: {fileID: 2284767481152605812}
|
||||||
handAnimator: {fileID: 6887173419118620922}
|
handAnimator: {fileID: 6887173419118620922}
|
||||||
--- !u!1 &9176706498249536598
|
--- !u!1 &9176706498249536598
|
||||||
GameObject:
|
GameObject:
|
||||||
|
@ -553,7 +611,6 @@ GameObject:
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 3170172331476655201}
|
- component: {fileID: 3170172331476655201}
|
||||||
- component: {fileID: 6887173419118620922}
|
- component: {fileID: 6887173419118620922}
|
||||||
- component: {fileID: 4532207818172471810}
|
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Arm
|
m_Name: Arm
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -597,27 +654,3 @@ Animator:
|
||||||
m_HasTransformHierarchy: 1
|
m_HasTransformHierarchy: 1
|
||||||
m_AllowConstantClipSamplingOptimization: 1
|
m_AllowConstantClipSamplingOptimization: 1
|
||||||
m_KeepAnimatorControllerStateOnDisable: 0
|
m_KeepAnimatorControllerStateOnDisable: 0
|
||||||
--- !u!114 &4532207818172471810
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 9176706498249536598}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 064f8eb876b68ff448e085a8c3df2db7, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
inList: 0
|
|
||||||
lastState: 0
|
|
||||||
state:
|
|
||||||
gameObject: {fileID: 0}
|
|
||||||
early: 0
|
|
||||||
perfect: 0
|
|
||||||
late: 0
|
|
||||||
createBeat: 0
|
|
||||||
eligibleHitsList: []
|
|
||||||
aceTimes: 0
|
|
||||||
isEligible: 0
|
|
||||||
triggersAutoplay: 1
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: c86bb199b366fb345b66a429c88e7bbf
|
guid: 9f31c51f546a40e4a929a3a7c4820258
|
||||||
AudioImporter:
|
AudioImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
|
|
BIN
Assets/Resources/Sfx/games/coinToss/applause.ogg
Normal file
BIN
Assets/Resources/Sfx/games/coinToss/applause.ogg
Normal file
Binary file not shown.
22
Assets/Resources/Sfx/games/coinToss/applause.ogg.meta
Normal file
22
Assets/Resources/Sfx/games/coinToss/applause.ogg.meta
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c86bb199b366fb345b66a429c88e7bbf
|
||||||
|
AudioImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 6
|
||||||
|
defaultSettings:
|
||||||
|
loadType: 0
|
||||||
|
sampleRateSetting: 0
|
||||||
|
sampleRateOverride: 44100
|
||||||
|
compressionFormat: 1
|
||||||
|
quality: 1
|
||||||
|
conversionMode: 0
|
||||||
|
platformSettingOverrides: {}
|
||||||
|
forceToMono: 0
|
||||||
|
normalize: 1
|
||||||
|
preloadAudioData: 1
|
||||||
|
loadInBackground: 0
|
||||||
|
ambisonic: 0
|
||||||
|
3D: 1
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
Assets/Resources/Sfx/games/coinToss/miss.wav
Normal file
BIN
Assets/Resources/Sfx/games/coinToss/miss.wav
Normal file
Binary file not shown.
22
Assets/Resources/Sfx/games/coinToss/miss.wav.meta
Normal file
22
Assets/Resources/Sfx/games/coinToss/miss.wav.meta
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 96d6d69630594804388f5b71a11e2b6e
|
||||||
|
AudioImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 6
|
||||||
|
defaultSettings:
|
||||||
|
loadType: 0
|
||||||
|
sampleRateSetting: 0
|
||||||
|
sampleRateOverride: 44100
|
||||||
|
compressionFormat: 1
|
||||||
|
quality: 1
|
||||||
|
conversionMode: 0
|
||||||
|
platformSettingOverrides: {}
|
||||||
|
forceToMono: 0
|
||||||
|
normalize: 1
|
||||||
|
preloadAudioData: 1
|
||||||
|
loadInBackground: 0
|
||||||
|
ambisonic: 0
|
||||||
|
3D: 1
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 96d6d69630594804388f5b71a11e2b6e
|
guid: b49816b082c733548aa2ee48154e114b
|
||||||
AudioImporter:
|
AudioImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System;
|
|
||||||
using UnityEngine;
|
|
||||||
using NaughtyBezierCurves;
|
|
||||||
|
|
||||||
using HeavenStudio.Util;
|
|
||||||
|
|
||||||
namespace HeavenStudio.Games.Scripts_CoinToss
|
|
||||||
{
|
|
||||||
public class Arm : PlayerActionObject
|
|
||||||
{
|
|
||||||
|
|
||||||
private Boolean isThrowing;
|
|
||||||
private Animator handAnimator;
|
|
||||||
|
|
||||||
private CoinToss game;
|
|
||||||
|
|
||||||
// Start is called before the first frame update
|
|
||||||
private void Awake()
|
|
||||||
{
|
|
||||||
isThrowing = false;
|
|
||||||
game = CoinToss.instance;
|
|
||||||
handAnimator = game.handAnimator;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
private void Update()
|
|
||||||
{
|
|
||||||
if (PlayerInput.Pressed() && state.perfect)
|
|
||||||
{
|
|
||||||
if (isThrowing)
|
|
||||||
{
|
|
||||||
Catch_Success();
|
|
||||||
isThrowing = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnAce()
|
|
||||||
{
|
|
||||||
if(isThrowing)
|
|
||||||
{
|
|
||||||
Catch_Success();
|
|
||||||
isThrowing = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Catch_Success()
|
|
||||||
{
|
|
||||||
Jukebox.PlayOneShotGame("coinToss/catch");
|
|
||||||
handAnimator.Play("Catch_success", 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
51
Assets/Scripts/Games/CoinToss/Coin.cs
Normal file
51
Assets/Scripts/Games/CoinToss/Coin.cs
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
using HeavenStudio.Util;
|
||||||
|
|
||||||
|
namespace HeavenStudio.Games.Scripts_CoinToss
|
||||||
|
{
|
||||||
|
public class Coin : PlayerActionObject
|
||||||
|
{
|
||||||
|
public float startBeat;
|
||||||
|
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
PlayerActionInit(this.gameObject, startBeat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnAce()
|
||||||
|
{
|
||||||
|
Hit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if (Conductor.instance.GetPositionFromBeat(startBeat, 1f) >= 6.3f)
|
||||||
|
MissCoin();
|
||||||
|
|
||||||
|
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 6f);
|
||||||
|
StateCheck(normalizedBeat);
|
||||||
|
|
||||||
|
if (PlayerInput.Pressed())
|
||||||
|
{
|
||||||
|
if (state.perfect)
|
||||||
|
{
|
||||||
|
Hit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Hit()
|
||||||
|
{
|
||||||
|
CoinToss.instance.Catch_Success();
|
||||||
|
Destroy(this.gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MissCoin()
|
||||||
|
{
|
||||||
|
CoinToss.instance.Catch_Miss();
|
||||||
|
Destroy(this.gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 064f8eb876b68ff448e085a8c3df2db7
|
guid: df09de01a35532c42b315b9b076cf88b
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
|
@ -27,16 +27,16 @@ namespace HeavenStudio.Games
|
||||||
{
|
{
|
||||||
|
|
||||||
public static CoinToss instance { get; set; }
|
public static CoinToss instance { get; set; }
|
||||||
|
|
||||||
public Boolean isThrowing;
|
public Boolean isThrowing;
|
||||||
|
|
||||||
|
public GameObject coin_cue;
|
||||||
|
|
||||||
[Header("Animators")]
|
[Header("Animators")]
|
||||||
public Animator handAnimator;
|
public Animator handAnimator;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
isThrowing = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
|
@ -55,7 +55,24 @@ namespace HeavenStudio.Games
|
||||||
handAnimator.Play("Throw", 0, 0);
|
handAnimator.Play("Throw", 0, 0);
|
||||||
|
|
||||||
isThrowing = true;
|
isThrowing = true;
|
||||||
|
|
||||||
|
GameObject coin = Instantiate(coin_cue);
|
||||||
|
coin.SetActive(true);
|
||||||
|
Coin c = coin.GetComponent<Coin>();
|
||||||
|
c.startBeat = beat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Catch_Success()
|
||||||
|
{
|
||||||
|
Jukebox.PlayOneShotGame("coinToss/catch");
|
||||||
|
handAnimator.Play("Catch_success", 0, 0);
|
||||||
|
|
||||||
|
isThrowing = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Catch_Miss()
|
||||||
|
{
|
||||||
|
Jukebox.PlayOneShotGame("coinToss/miss");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue