Inputs added, near completion
This commit is contained in:
parent
ca07b6a468
commit
7a2d08b5f2
|
@ -1414,8 +1414,8 @@ Transform:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3516190332723367424}
|
||||
m_LocalRotation: {x: -0, y: -0, z: 0.15042458, w: 0.98862153}
|
||||
m_LocalPosition: {x: -3.81, y: 4.71, z: 0}
|
||||
m_LocalScale: {x: 1.5, y: 1.5, z: 1}
|
||||
m_LocalPosition: {x: -3.57, y: 1.87, z: 0}
|
||||
m_LocalScale: {x: 1.4, y: 1.4, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1752138342201532195}
|
||||
m_RootOrder: 4
|
||||
|
@ -1556,7 +1556,7 @@ ParticleSystem:
|
|||
startSpeed:
|
||||
serializedVersion: 2
|
||||
minMaxState: 0
|
||||
scalar: 1
|
||||
scalar: 0.5
|
||||
minScalar: 5
|
||||
maxCurve:
|
||||
serializedVersion: 2
|
||||
|
@ -1830,7 +1830,7 @@ ParticleSystem:
|
|||
m_RotationOrder: 4
|
||||
startRotationX:
|
||||
serializedVersion: 2
|
||||
minMaxState: 0
|
||||
minMaxState: 3
|
||||
scalar: 0
|
||||
minScalar: 0
|
||||
maxCurve:
|
||||
|
@ -1883,7 +1883,7 @@ ParticleSystem:
|
|||
m_RotationOrder: 4
|
||||
startRotationY:
|
||||
serializedVersion: 2
|
||||
minMaxState: 0
|
||||
minMaxState: 3
|
||||
scalar: 0
|
||||
minScalar: 0
|
||||
maxCurve:
|
||||
|
@ -1936,8 +1936,8 @@ ParticleSystem:
|
|||
m_RotationOrder: 4
|
||||
startRotation:
|
||||
serializedVersion: 2
|
||||
minMaxState: 0
|
||||
scalar: 0
|
||||
minMaxState: 3
|
||||
scalar: 1.5707963
|
||||
minScalar: 0
|
||||
maxCurve:
|
||||
serializedVersion: 2
|
||||
|
@ -2047,15 +2047,15 @@ ParticleSystem:
|
|||
ShapeModule:
|
||||
serializedVersion: 6
|
||||
enabled: 1
|
||||
type: 4
|
||||
type: 17
|
||||
angle: 50
|
||||
length: 5
|
||||
boxThickness: {x: 0, y: 0, z: 0}
|
||||
radiusThickness: 1
|
||||
donutRadius: 0.2
|
||||
m_Position: {x: 0, y: 0, z: 0}
|
||||
m_Rotation: {x: -90, y: 0, z: 0}
|
||||
m_Scale: {x: 1, y: 1, z: 1}
|
||||
m_Rotation: {x: 0, y: 0, z: 0}
|
||||
m_Scale: {x: 1.3, y: 1, z: 0.8}
|
||||
placementMode: 0
|
||||
m_MeshMaterialIndex: 0
|
||||
m_MeshNormalOffset: 0
|
||||
|
@ -2131,8 +2131,8 @@ ParticleSystem:
|
|||
m_TextureAlphaAffectsParticles: 1
|
||||
m_TextureBilinearFiltering: 0
|
||||
randomDirectionAmount: 0
|
||||
sphericalDirectionAmount: 0
|
||||
randomPositionAmount: 0.5
|
||||
sphericalDirectionAmount: 1
|
||||
randomPositionAmount: 0
|
||||
radius:
|
||||
value: 1.5
|
||||
mode: 0
|
||||
|
@ -2191,7 +2191,7 @@ ParticleSystem:
|
|||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
arc:
|
||||
value: 360
|
||||
value: 180
|
||||
mode: 0
|
||||
spread: 0
|
||||
speed:
|
||||
|
@ -2253,7 +2253,7 @@ ParticleSystem:
|
|||
rateOverTime:
|
||||
serializedVersion: 2
|
||||
minMaxState: 0
|
||||
scalar: 200
|
||||
scalar: 150
|
||||
minScalar: 10
|
||||
maxCurve:
|
||||
serializedVersion: 2
|
||||
|
@ -4772,7 +4772,7 @@ ParticleSystem:
|
|||
range: {x: 0, y: 1}
|
||||
separateAxes: 0
|
||||
RotationBySpeedModule:
|
||||
enabled: 0
|
||||
enabled: 1
|
||||
x:
|
||||
serializedVersion: 2
|
||||
minMaxState: 0
|
||||
|
@ -6743,6 +6743,7 @@ MonoBehaviour:
|
|||
firstEnable: 0
|
||||
handsAnimator: {fileID: 1599401704102748781}
|
||||
monkeyAnimator: {fileID: 241274462882064872}
|
||||
flowerParticles: {fileID: 5490304671109547141}
|
||||
--- !u!1 &4845574485429671826
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
BIN
Assets/Resources/Sfx/games/tambourine/frog.wav
Normal file
BIN
Assets/Resources/Sfx/games/tambourine/frog.wav
Normal file
Binary file not shown.
22
Assets/Resources/Sfx/games/tambourine/frog.wav.meta
Normal file
22
Assets/Resources/Sfx/games/tambourine/frog.wav.meta
Normal file
|
@ -0,0 +1,22 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 48467fd679ba9f44ea31bb386e822c1f
|
||||
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/tambourine/frogJump.wav
Normal file
BIN
Assets/Resources/Sfx/games/tambourine/frogJump.wav
Normal file
Binary file not shown.
22
Assets/Resources/Sfx/games/tambourine/frogJump.wav.meta
Normal file
22
Assets/Resources/Sfx/games/tambourine/frogJump.wav.meta
Normal file
|
@ -0,0 +1,22 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c2a953b9ad12f7340a199d08ea31dc64
|
||||
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/tambourine/miss.wav
Normal file
BIN
Assets/Resources/Sfx/games/tambourine/miss.wav
Normal file
Binary file not shown.
22
Assets/Resources/Sfx/games/tambourine/miss.wav.meta
Normal file
22
Assets/Resources/Sfx/games/tambourine/miss.wav.meta
Normal file
|
@ -0,0 +1,22 @@
|
|||
fileFormatVersion: 2
|
||||
guid: efedacace218da148a6f30046adcc177
|
||||
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:
|
|
@ -21,22 +21,22 @@ namespace HeavenStudio.Games.Loaders
|
|||
},
|
||||
new GameAction("shake", "Shake")
|
||||
{
|
||||
function = delegate {var e = eventCaller.currentEntity; Tambourine.instance.Shake(e.beat); },
|
||||
function = delegate {var e = eventCaller.currentEntity; Tambourine.instance.MonkeyInput(e.beat, false); },
|
||||
defaultLength = 0.5f,
|
||||
priority = 2
|
||||
},
|
||||
new GameAction("hit", "Hit")
|
||||
{
|
||||
function = delegate {var e = eventCaller.currentEntity; Tambourine.instance.Hit(e.beat); },
|
||||
function = delegate {var e = eventCaller.currentEntity; Tambourine.instance.MonkeyInput(e.beat, true); },
|
||||
defaultLength = 0.5f,
|
||||
priority = 2
|
||||
},
|
||||
new GameAction("pass turn", "Pass Turn")
|
||||
{
|
||||
function = delegate {var e = eventCaller.currentEntity; Tambourine.instance.PassTurn(e.beat, e.length); },
|
||||
defaultLength = 0.5f,
|
||||
defaultLength = 1f,
|
||||
resizable = true,
|
||||
priority = 1
|
||||
priority = 3
|
||||
},
|
||||
new GameAction("bop", "Bop")
|
||||
{
|
||||
|
@ -46,7 +46,13 @@ namespace HeavenStudio.Games.Loaders
|
|||
new Param("whoBops", Tambourine.WhoBops.Both, "Who Bops", "Who will bop."),
|
||||
},
|
||||
defaultLength = 1f,
|
||||
priority = 3
|
||||
priority = 4
|
||||
},
|
||||
new GameAction("success", "Success")
|
||||
{
|
||||
function = delegate {var e = eventCaller.currentEntity; Tambourine.instance.SuccessFace(e.beat); },
|
||||
defaultLength = 1f,
|
||||
priority = 4,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -61,6 +67,13 @@ namespace HeavenStudio.Games
|
|||
[Header("Components")]
|
||||
[SerializeField] Animator handsAnimator;
|
||||
[SerializeField] Animator monkeyAnimator;
|
||||
[SerializeField] ParticleSystem flowerParticles;
|
||||
|
||||
[Header("Variables")]
|
||||
bool intervalStarted;
|
||||
float intervalStartBeat;
|
||||
float beatInterval = 4f;
|
||||
float misses;
|
||||
|
||||
public enum WhoBops
|
||||
{
|
||||
|
@ -69,6 +82,13 @@ namespace HeavenStudio.Games
|
|||
Both
|
||||
}
|
||||
|
||||
static List<QueuedTambourineInput> queuedInputs = new List<QueuedTambourineInput>();
|
||||
struct QueuedTambourineInput
|
||||
{
|
||||
public bool hit;
|
||||
public float beatAwayFromStart;
|
||||
}
|
||||
|
||||
public static Tambourine instance;
|
||||
|
||||
void Awake()
|
||||
|
@ -88,29 +108,71 @@ namespace HeavenStudio.Games
|
|||
handsAnimator.Play("Smack", 0, 0);
|
||||
Jukebox.PlayOneShotGame($"tambourine/player/hit/{UnityEngine.Random.Range(1, 6)}");
|
||||
}
|
||||
if (!Conductor.instance.isPlaying && !Conductor.instance.isPaused && intervalStarted)
|
||||
{
|
||||
intervalStarted = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void StartInterval(float beat, float interval)
|
||||
{
|
||||
|
||||
intervalStartBeat = beat;
|
||||
beatInterval = interval;
|
||||
if (!intervalStarted)
|
||||
{
|
||||
queuedInputs.Clear();
|
||||
misses = 0;
|
||||
intervalStarted = true;
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + beatInterval, delegate { intervalStarted = false; }),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void Shake(float beat)
|
||||
public void MonkeyInput(float beat, bool hit)
|
||||
{
|
||||
monkeyAnimator.Play("MonkeyShake", 0, 0);
|
||||
Jukebox.PlayOneShotGame($"tambourine/monkey/shake/{UnityEngine.Random.Range(1, 6)}");
|
||||
}
|
||||
|
||||
public void Hit(float beat)
|
||||
{
|
||||
monkeyAnimator.Play("MonkeySmack", 0, 0);
|
||||
Jukebox.PlayOneShotGame($"tambourine/monkey/hit/{UnityEngine.Random.Range(1, 6)}");
|
||||
if (!intervalStarted)
|
||||
{
|
||||
StartInterval(beat, beatInterval);
|
||||
}
|
||||
if (hit)
|
||||
{
|
||||
monkeyAnimator.Play("MonkeySmack", 0, 0);
|
||||
Jukebox.PlayOneShotGame($"tambourine/monkey/hit/{UnityEngine.Random.Range(1, 6)}");
|
||||
}
|
||||
else
|
||||
{
|
||||
monkeyAnimator.Play("MonkeyShake", 0, 0);
|
||||
Jukebox.PlayOneShotGame($"tambourine/monkey/shake/{UnityEngine.Random.Range(1, 6)}");
|
||||
}
|
||||
queuedInputs.Add(new QueuedTambourineInput()
|
||||
{
|
||||
hit = hit,
|
||||
beatAwayFromStart = beat - intervalStartBeat,
|
||||
});
|
||||
}
|
||||
|
||||
public void PassTurn(float beat, float length)
|
||||
{
|
||||
if (queuedInputs.Count == 0) return;
|
||||
monkeyAnimator.Play("MonkeyPassTurn", 0, 0);
|
||||
Jukebox.PlayOneShotGame($"tambourine/monkey/turnPass/{UnityEngine.Random.Range(1, 6)}");
|
||||
foreach(var input in queuedInputs)
|
||||
{
|
||||
if (input.hit)
|
||||
{
|
||||
ScheduleInput(beat + length, input.beatAwayFromStart, InputType.STANDARD_ALT_DOWN , JustHit, Miss , Nothing);
|
||||
}
|
||||
else
|
||||
{
|
||||
ScheduleInput(beat + length, input.beatAwayFromStart, InputType.STANDARD_DOWN, JustShake, Miss, Nothing);
|
||||
}
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + length + input.beatAwayFromStart, delegate { Bop(beat + length + input.beatAwayFromStart, (int)WhoBops.Monkey); })
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void Bop(float beat, int whoBops)
|
||||
|
@ -129,5 +191,72 @@ namespace HeavenStudio.Games
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void SuccessFace(float beat)
|
||||
{
|
||||
if (misses > 0) return;
|
||||
flowerParticles.Play();
|
||||
Jukebox.PlayOneShotGame($"tambourine/player/turnPass/sweep");
|
||||
MultiSound.Play(new MultiSound.Sound[]
|
||||
{
|
||||
new MultiSound.Sound("tambourine/player/turnPass/note1", beat),
|
||||
new MultiSound.Sound("tambourine/player/turnPass/note2", beat + 0.1f),
|
||||
new MultiSound.Sound("tambourine/player/turnPass/note3", beat + 0.2f),
|
||||
new MultiSound.Sound("tambourine/player/turnPass/note3", beat + 0.3f),
|
||||
}, forcePlay: true);
|
||||
monkeyAnimator.Play("MonkeySuccessFace", 0, 0);
|
||||
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + 1, delegate { monkeyAnimator.Play("MonkeyIdle", 0, 0); }),
|
||||
});
|
||||
}
|
||||
|
||||
public void JustHit(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (state >= 1f || state <= -1f)
|
||||
{
|
||||
handsAnimator.Play("Smack", 0, 0);
|
||||
Jukebox.PlayOneShotGame($"tambourine/player/hit/{UnityEngine.Random.Range(1, 6)}");
|
||||
Jukebox.PlayOneShotGame("tambourine/miss");
|
||||
misses++;
|
||||
return;
|
||||
}
|
||||
Success(true);
|
||||
}
|
||||
|
||||
public void JustShake(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (state >= 1f || state <= -1f)
|
||||
{
|
||||
handsAnimator.Play("Shake", 0, 0);
|
||||
Jukebox.PlayOneShotGame($"tambourine/player/shake/{UnityEngine.Random.Range(1, 6)}");
|
||||
Jukebox.PlayOneShotGame("tambourine/miss");
|
||||
misses++;
|
||||
return;
|
||||
}
|
||||
Success(false);
|
||||
}
|
||||
|
||||
public void Success(bool hit)
|
||||
{
|
||||
if (hit)
|
||||
{
|
||||
handsAnimator.Play("Smack", 0, 0);
|
||||
Jukebox.PlayOneShotGame($"tambourine/player/hit/{UnityEngine.Random.Range(1, 6)}");
|
||||
}
|
||||
else
|
||||
{
|
||||
handsAnimator.Play("Shake", 0, 0);
|
||||
Jukebox.PlayOneShotGame($"tambourine/player/shake/{UnityEngine.Random.Range(1, 6)}");
|
||||
}
|
||||
}
|
||||
|
||||
public void Miss(PlayerActionEvent caller)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("tambourine/frog");
|
||||
misses++;
|
||||
}
|
||||
|
||||
public void Nothing(PlayerActionEvent caller) {}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue