mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 12:17:37 +02:00
8
Assets/Scripts/Games/FanClub.meta
Normal file
8
Assets/Scripts/Games/FanClub.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a1e38688ca9c20458b809361e5ea36f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
435
Assets/Scripts/Games/FanClub/FanClub.cs
Normal file
435
Assets/Scripts/Games/FanClub/FanClub.cs
Normal file
@ -0,0 +1,435 @@
|
||||
using HeavenStudio.Util;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering; //don't ask
|
||||
|
||||
namespace HeavenStudio.Games
|
||||
{
|
||||
// none yet
|
||||
using Scripts_FanClub;
|
||||
|
||||
public class FanClub : Minigame
|
||||
{
|
||||
public enum IdolAnimations {
|
||||
Bop,
|
||||
PeaceVocal,
|
||||
Peace,
|
||||
Clap,
|
||||
Call,
|
||||
Response,
|
||||
Jump,
|
||||
Dab
|
||||
}
|
||||
|
||||
// userdata here
|
||||
[Header("Animators")]
|
||||
|
||||
[Header("Objects")]
|
||||
public GameObject Arisa;
|
||||
public ParticleSystem idolClapEffect;
|
||||
public GameObject spectator;
|
||||
public GameObject spectatorAnchor;
|
||||
|
||||
// end userdata
|
||||
|
||||
//arisa's animation controller
|
||||
private Animator idolAnimator;
|
||||
//spectators
|
||||
private List<GameObject> Spectators;
|
||||
public NtrIdolFan Player;
|
||||
|
||||
//bop-type animations
|
||||
public GameEvent bop = new GameEvent();
|
||||
public GameEvent specBop = new GameEvent();
|
||||
public GameEvent handCrap = new GameEvent();
|
||||
public GameEvent response = new GameEvent();
|
||||
//game scene
|
||||
public static FanClub instance;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
const int FAN_COUNT = 12;
|
||||
const float RADIUS = 1.3f;
|
||||
private void Start()
|
||||
{
|
||||
Spectators = new List<GameObject>();
|
||||
idolAnimator = Arisa.GetComponent<Animator>();
|
||||
|
||||
// procedurally spawning the spectators
|
||||
// from middle of viewport:
|
||||
|
||||
// |========A========|
|
||||
// f==f==f==0==p==f==f
|
||||
// =f==f==0==0==f==f==
|
||||
|
||||
//spawn 10, the 4th is our player (idx 3)
|
||||
Vector3 origin = spectatorAnchor.transform.localPosition;
|
||||
int sortOrigin = spectatorAnchor.GetComponent<SortingGroup>().sortingOrder;
|
||||
Vector3 spawnPos = new Vector3(origin.x, origin.y, origin.z);
|
||||
spawnPos.x -= RADIUS * 2 * 3;
|
||||
for (int i = 0; i < FAN_COUNT; i++)
|
||||
{
|
||||
GameObject mobj = Instantiate(spectator, spectatorAnchor.transform.parent);
|
||||
mobj.transform.localPosition = new Vector3(spawnPos.x, spawnPos.y, spawnPos.z);
|
||||
mobj.GetComponent<SortingGroup>().sortingOrder = i + sortOrigin;
|
||||
if (i == 3)
|
||||
{
|
||||
Player = mobj.GetComponent<NtrIdolFan>();
|
||||
Player.player = true;
|
||||
}
|
||||
Spectators.Add(mobj);
|
||||
|
||||
//prepare spawn point of next spectator
|
||||
spawnPos.x += RADIUS * 2;
|
||||
if (i == 2)
|
||||
spawnPos.x += RADIUS * 2;
|
||||
if (i == 8)
|
||||
spawnPos.x += RADIUS * 4;
|
||||
if (i == 5)
|
||||
{
|
||||
spawnPos = new Vector3(origin.x, origin.y, origin.z);
|
||||
spawnPos.x -= RADIUS * 2 * 4 - RADIUS;
|
||||
spawnPos.y -= RADIUS;
|
||||
// spawnPos.z -= RADIUS/4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Conductor.instance.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
|
||||
{
|
||||
if (Conductor.instance.songPositionInBeats >= specBop.startBeat && Conductor.instance.songPositionInBeats < specBop.startBeat + specBop.length)
|
||||
BopAll();
|
||||
|
||||
if (Conductor.instance.songPositionInBeats >= response.startBeat && Conductor.instance.songPositionInBeats < response.startBeat + response.length)
|
||||
{
|
||||
idolAnimator.Play("IdolResponse", 0, 0);
|
||||
}
|
||||
else if (Conductor.instance.songPositionInBeats >= handCrap.startBeat && Conductor.instance.songPositionInBeats < handCrap.startBeat + handCrap.length)
|
||||
{
|
||||
idolAnimator.Play("IdolCrap", 0, 0);
|
||||
idolClapEffect.Play();
|
||||
}
|
||||
else if (Conductor.instance.songPositionInBeats >= bop.startBeat && Conductor.instance.songPositionInBeats < bop.startBeat + bop.length)
|
||||
{
|
||||
idolAnimator.Play("IdolBeat", 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Bop(float beat, float length)
|
||||
{
|
||||
bop.length = length;
|
||||
bop.startBeat = beat;
|
||||
SpecBop(beat, length);
|
||||
}
|
||||
|
||||
public void SpecBop(float beat, float length)
|
||||
{
|
||||
specBop.length = length;
|
||||
specBop.startBeat = beat;
|
||||
}
|
||||
|
||||
public void PlayAnim(float beat, int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case (int) IdolAnimations.Bop:
|
||||
idolAnimator.Play("IdolBeat", 0, 0);
|
||||
break;
|
||||
case (int) IdolAnimations.PeaceVocal:
|
||||
idolAnimator.Play("IdolPeace", 0, 0);
|
||||
break;
|
||||
case (int) IdolAnimations.Peace:
|
||||
idolAnimator.Play("IdolPeaceNoSync", 0, 0);
|
||||
break;
|
||||
case (int) IdolAnimations.Clap:
|
||||
idolAnimator.Play("IdolCrap", 0, 0);
|
||||
idolClapEffect.Play();
|
||||
break;
|
||||
case (int) IdolAnimations.Call:
|
||||
BeatAction.New(Arisa, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { Arisa.GetComponent<Animator>().Play("IdolCall0", 0, 0); }),
|
||||
new BeatAction.Action(beat + 0.75f, delegate { Arisa.GetComponent<Animator>().Play("IdolCall1", 0, 0); }),
|
||||
});
|
||||
break;
|
||||
case (int) IdolAnimations.Response:
|
||||
idolAnimator.Play("IdolResponse", 0, 0);
|
||||
break;
|
||||
case (int) IdolAnimations.Jump:
|
||||
DoIdolJump(beat);
|
||||
break;
|
||||
case (int) IdolAnimations.Dab:
|
||||
idolAnimator.Play("IdolDab", 0, 0);
|
||||
Jukebox.PlayOneShotGame("fanClub/arisa_dab");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void DoIdolJump(float beat)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
const float HAIS_LENGTH = 4f;
|
||||
public void CallHai(float beat, int type = 0)
|
||||
{
|
||||
bool shouldSpecBop = false;
|
||||
// if spectators need to bop
|
||||
if (specBop.startBeat + specBop.length > beat && specBop.startBeat < beat)
|
||||
{
|
||||
//let bopping continue *after* this cue
|
||||
if (specBop.startBeat + specBop.length > beat + HAIS_LENGTH)
|
||||
{
|
||||
shouldSpecBop = true;
|
||||
}
|
||||
}
|
||||
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("fanClub/arisa_hai_1_jp", beat),
|
||||
new MultiSound.Sound("fanClub/arisa_hai_2_jp", beat + 1f),
|
||||
new MultiSound.Sound("fanClub/arisa_hai_3_jp", beat + 2f),
|
||||
});
|
||||
|
||||
Prepare(beat + 3f);
|
||||
Prepare(beat + 4f);
|
||||
Prepare(beat + 5f);
|
||||
Prepare(beat + 6f);
|
||||
|
||||
BeatAction.New(Arisa, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { Arisa.GetComponent<Animator>().Play("IdolPeace", 0, 0); if (shouldSpecBop) {BopAll();}}),
|
||||
new BeatAction.Action(beat + 1f, delegate { Arisa.GetComponent<Animator>().Play("IdolPeace", 0, 0); if (shouldSpecBop) {BopAll();}}),
|
||||
new BeatAction.Action(beat + 2f, delegate { Arisa.GetComponent<Animator>().Play("IdolPeace", 0, 0); if (shouldSpecBop) {BopAll();}}),
|
||||
new BeatAction.Action(beat + 3f, delegate { Arisa.GetComponent<Animator>().Play("IdolPeaceNoSync", 0, 0); PlayAnimationAll("FanPrepare"); }),
|
||||
|
||||
new BeatAction.Action(beat + 4f, delegate { PlayOneClap(beat + 4f);}),
|
||||
new BeatAction.Action(beat + 5f, delegate { PlayOneClap(beat + 5f);}),
|
||||
new BeatAction.Action(beat + 6f, delegate { PlayOneClap(beat + 6f);}),
|
||||
new BeatAction.Action(beat + 7f, delegate { PlayOneClap(beat + 7f);}),
|
||||
});
|
||||
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("fanClub/crowd_hai_jp", beat + 4f),
|
||||
new MultiSound.Sound("fanClub/crowd_hai_jp", beat + 5f),
|
||||
new MultiSound.Sound("fanClub/crowd_hai_jp", beat + 6f),
|
||||
new MultiSound.Sound("fanClub/crowd_hai_jp", beat + 7f),
|
||||
});
|
||||
|
||||
handCrap.length = 4f;
|
||||
handCrap.startBeat = beat + 4f;
|
||||
}
|
||||
|
||||
public static void WarnHai(float beat, int type = 0)
|
||||
{
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("fanClub/arisa_hai_1_jp", beat),
|
||||
new MultiSound.Sound("fanClub/arisa_hai_2_jp", beat + 1f),
|
||||
new MultiSound.Sound("fanClub/arisa_hai_3_jp", beat + 2f),
|
||||
}, forcePlay:true);
|
||||
}
|
||||
|
||||
const float CALL_LENGTH = 2f;
|
||||
public void CallKamone(float beat, int type = 0, bool doJump = false)
|
||||
{
|
||||
bool shouldSpecBop = false;
|
||||
// clip certain events to the start of this cue if needed
|
||||
if (bop.startBeat + bop.length > beat && bop.startBeat < beat)
|
||||
{
|
||||
//let bopping continue *after* this cue
|
||||
if (bop.startBeat + bop.length > beat + CALL_LENGTH)
|
||||
{
|
||||
bop.length -= (beat + CALL_LENGTH - bop.startBeat);
|
||||
bop.startBeat = beat + CALL_LENGTH;
|
||||
}
|
||||
else
|
||||
bop.length = beat - bop.startBeat;
|
||||
}
|
||||
// interrupt clapping completely, no need to continue
|
||||
if (handCrap.startBeat + handCrap.length > beat && handCrap.startBeat < beat)
|
||||
handCrap.length = beat - handCrap.startBeat;
|
||||
// same with responses
|
||||
if (response.startBeat + response.length > beat && response.startBeat < beat)
|
||||
response.length = beat - response.startBeat;
|
||||
|
||||
// if spectators need to bop
|
||||
if (specBop.startBeat + specBop.length > beat && specBop.startBeat < beat)
|
||||
{
|
||||
//let bopping continue *after* this cue
|
||||
if (specBop.startBeat + specBop.length > beat + CALL_LENGTH)
|
||||
{
|
||||
shouldSpecBop = true;
|
||||
}
|
||||
}
|
||||
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("fanClub/arisa_ka_jp", beat),
|
||||
new MultiSound.Sound("fanClub/arisa_mo_jp", beat + 0.5f),
|
||||
new MultiSound.Sound("fanClub/arisa_ne_jp", beat + 1f),
|
||||
});
|
||||
|
||||
BeatAction.New(Arisa, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { Arisa.GetComponent<Animator>().Play("IdolCall0", 0, 0); if (shouldSpecBop) {BopAll();}}),
|
||||
new BeatAction.Action(beat + 0.75f, delegate { Arisa.GetComponent<Animator>().Play("IdolCall1", 0, 0); }),
|
||||
new BeatAction.Action(beat + 1f, delegate { PlayAnimationAll("FanPrepare"); Prepare(beat + 1f);}),
|
||||
|
||||
new BeatAction.Action(beat + 2f, delegate { PlayLongClap(beat + 2f); Prepare(beat + 2.5f);}),
|
||||
new BeatAction.Action(beat + 3.5f, delegate { PlayOneClap(beat + 3.5f); Prepare(beat + 3f, 2);}),
|
||||
new BeatAction.Action(beat + 4f, delegate { PlayChargeClap(beat + 4f); Prepare(beat + 4f, 1);}),
|
||||
new BeatAction.Action(beat + 5f, delegate { PlayJump(beat + 5f);
|
||||
if (doJump)
|
||||
{
|
||||
DoIdolJump(beat + 5f);
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("fanClub/crowd_ka_jp", beat + 2f),
|
||||
new MultiSound.Sound("fanClub/crowd_mo_jp", beat + 3.5f),
|
||||
new MultiSound.Sound("fanClub/crowd_ne_jp", beat + 4f),
|
||||
new MultiSound.Sound("fanClub/crowd_hey_jp", beat + 5f),
|
||||
});
|
||||
|
||||
response.length = doJump ? 3f : 4f;
|
||||
response.startBeat = beat + CALL_LENGTH;
|
||||
}
|
||||
|
||||
public static void WarnKamone(float beat, int type = 0)
|
||||
{
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("fanClub/arisa_ka_jp", beat),
|
||||
new MultiSound.Sound("fanClub/arisa_mo_jp", beat + 0.5f),
|
||||
new MultiSound.Sound("fanClub/arisa_ne_jp", beat + 1f),
|
||||
}, forcePlay:true);
|
||||
}
|
||||
|
||||
const float BIGCALL_LENGTH = 2.5f;
|
||||
public void CallBigReady(float beat)
|
||||
{
|
||||
// clip certain events to the start of this cue if needed
|
||||
if (specBop.startBeat + specBop.length > beat && specBop.startBeat < beat)
|
||||
{
|
||||
//let bopping continue *after* this cue
|
||||
if (specBop.startBeat + specBop.length > beat + BIGCALL_LENGTH)
|
||||
{
|
||||
specBop.length -= (beat + BIGCALL_LENGTH - specBop.startBeat);
|
||||
specBop.startBeat = beat + BIGCALL_LENGTH;
|
||||
}
|
||||
else
|
||||
specBop.length = beat - specBop.startBeat;
|
||||
}
|
||||
|
||||
Jukebox.PlayOneShotGame("fanClub/crowd_big_ready");
|
||||
|
||||
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { PlayAnimationAll("FanBigReady"); Prepare(beat + 1.5f);}),
|
||||
new BeatAction.Action(beat + 2f, delegate { PlayAnimationAll("FanBigReady"); Prepare(beat + 2f);}),
|
||||
new BeatAction.Action(beat + 2.5f, delegate { PlayOneClap(beat + 2.5f);}),
|
||||
new BeatAction.Action(beat + 3f, delegate { PlayOneClap(beat + 3f);}),
|
||||
});
|
||||
}
|
||||
|
||||
public static void WarnBigReady(float beat)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("fanClub/crowd_big_ready");
|
||||
}
|
||||
|
||||
public void Prepare(float beat, int type = 0)
|
||||
{
|
||||
Player.AddHit(beat, type);
|
||||
}
|
||||
|
||||
private void PlayAnimationAll(string anim, bool noPlayer = false, bool doForced = false)
|
||||
{
|
||||
for (int i = 0; i < Spectators.Count; i++)
|
||||
{
|
||||
if (i == 3 && noPlayer)
|
||||
continue;
|
||||
|
||||
if (!Spectators[i].GetComponent<Animator>().IsAnimationNotPlaying() && !doForced)
|
||||
continue;
|
||||
Spectators[i].GetComponent<Animator>().Play(anim);
|
||||
}
|
||||
}
|
||||
|
||||
private void BopAll(bool noPlayer = false, bool doForced = false)
|
||||
{
|
||||
for (int i = 0; i < Spectators.Count; i++)
|
||||
{
|
||||
if (i == 3 && noPlayer)
|
||||
continue;
|
||||
|
||||
if (!Spectators[i].GetComponent<Animator>().IsAnimationNotPlaying() && !doForced)
|
||||
continue;
|
||||
Spectators[i].GetComponent<NtrIdolFan>().Bop();
|
||||
}
|
||||
}
|
||||
|
||||
private void PlayOneClap(float beat)
|
||||
{
|
||||
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { PlayAnimationAll("FanClap", true, true);}),
|
||||
new BeatAction.Action(beat + 0.25f, delegate { PlayAnimationAll("FanFree", true);}),
|
||||
});
|
||||
}
|
||||
|
||||
private void PlayLongClap(float beat)
|
||||
{
|
||||
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { PlayAnimationAll("FanClap", true, true);}),
|
||||
new BeatAction.Action(beat + 1f, delegate { PlayAnimationAll("FanFree", true);}),
|
||||
});
|
||||
}
|
||||
|
||||
private void PlayChargeClap(float beat)
|
||||
{
|
||||
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { PlayAnimationAll("FanClap", true, true);}),
|
||||
new BeatAction.Action(beat + 0.1f, delegate { PlayAnimationAll("FanClapCharge", true, true);}),
|
||||
});
|
||||
}
|
||||
|
||||
private void StartJump(int idx, float beat)
|
||||
{
|
||||
Spectators[idx].GetComponent<NtrIdolFan>().jumpStartTime = beat;
|
||||
BeatAction.New(Spectators[idx], new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { Spectators[idx].GetComponent<Animator>().Play("FanJump", -1, 0);}),
|
||||
new BeatAction.Action(beat + 1f, delegate { Spectators[idx].GetComponent<Animator>().Play("FanPrepare", -1, 0);}),
|
||||
});
|
||||
}
|
||||
|
||||
private void PlayJump(float beat)
|
||||
{
|
||||
for (int i = 0; i < Spectators.Count; i++)
|
||||
{
|
||||
if (i == 3)
|
||||
continue;
|
||||
|
||||
StartJump(i, beat);
|
||||
}
|
||||
}
|
||||
|
||||
public void AngerOnMiss()
|
||||
{
|
||||
for (int i = 0; i <= 5; i++)
|
||||
{
|
||||
if (i == 3)
|
||||
continue;
|
||||
Spectators[i].GetComponent<NtrIdolFan>().MakeAngry(i > 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/FanClub/FanClub.cs.meta
Normal file
11
Assets/Scripts/Games/FanClub/FanClub.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8bf5d56f80c8814489e7b35cc9421ff
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
289
Assets/Scripts/Games/FanClub/NtrIdolFan.cs
Normal file
289
Assets/Scripts/Games/FanClub/NtrIdolFan.cs
Normal file
@ -0,0 +1,289 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using Starpelly;
|
||||
using NaughtyBezierCurves;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_FanClub
|
||||
{
|
||||
public class NtrIdolFan : PlayerActionObject
|
||||
{
|
||||
[Header("References")]
|
||||
[SerializeField] private GameObject motionRoot;
|
||||
[SerializeField] private GameObject headRoot;
|
||||
public Animator animator;
|
||||
public Animator headAnimator;
|
||||
public ParticleSystem fanClapEffect;
|
||||
public GameObject shadow;
|
||||
|
||||
[Header("Properties")]
|
||||
[NonSerialized] public bool player = false;
|
||||
[NonSerialized] public bool hitValid = false;
|
||||
public float jumpStartTime = -99f;
|
||||
bool stopBeat = false;
|
||||
bool stopCharge = false;
|
||||
bool hasJumped = false;
|
||||
|
||||
float clappingStartTime = 0f;
|
||||
|
||||
public Queue<KeyValuePair<float, int>> upcomingHits;
|
||||
public float startBeat;
|
||||
public int type;
|
||||
public bool doCharge = false;
|
||||
private bool inputHit = false;
|
||||
private bool hasHit = false;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (player)
|
||||
upcomingHits = new Queue<KeyValuePair<float, int>>(); // beat, type
|
||||
|
||||
inputHit = true;
|
||||
hasHit = true;
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
{
|
||||
Hit(true, type, true);
|
||||
}
|
||||
|
||||
public void AddHit(float beat, int type)
|
||||
{
|
||||
inputHit = false;
|
||||
upcomingHits.Enqueue(new KeyValuePair<float, int>(beat, type));
|
||||
}
|
||||
|
||||
public void Hit(bool _hit, int type = 0, bool fromAutoplay = false)
|
||||
{
|
||||
if (player && !hasHit)
|
||||
{
|
||||
if (type == 0)
|
||||
ClapStart(_hit, true, doCharge, fromAutoplay);
|
||||
else if (type == 1)
|
||||
JumpStart(_hit, true, fromAutoplay);
|
||||
|
||||
hasHit = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
// read cue queue and pop when needed
|
||||
if (hasHit)
|
||||
{
|
||||
if (upcomingHits?.Count > 0)
|
||||
{
|
||||
var next = upcomingHits.Dequeue();
|
||||
|
||||
startBeat = next.Key;
|
||||
type = next.Value == 2 ? 0 : next.Value;
|
||||
doCharge = (next.Value == 2);
|
||||
|
||||
// reset our shit to prepare for next hit
|
||||
hasHit = false;
|
||||
ResetState();
|
||||
}
|
||||
else if (Conductor.instance.GetPositionFromBeat(startBeat, 1) >= Minigame.EndTime())
|
||||
{
|
||||
startBeat = Single.MinValue;
|
||||
type = 0;
|
||||
doCharge = false;
|
||||
// DO NOT RESET, wait for future cues
|
||||
}
|
||||
}
|
||||
|
||||
// no input?
|
||||
if (!hasHit && Conductor.instance.GetPositionFromBeat(startBeat, 1f) >= Minigame.EndTime())
|
||||
{
|
||||
FanClub.instance.AngerOnMiss();
|
||||
hasHit = true;
|
||||
}
|
||||
|
||||
// dunno what this is for
|
||||
if (!inputHit && Conductor.instance.GetPositionFromBeat(startBeat, 1) >= Minigame.EndTime())
|
||||
{
|
||||
inputHit = true;
|
||||
}
|
||||
|
||||
if (!hasHit)
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 1);
|
||||
StateCheck(normalizedBeat);
|
||||
}
|
||||
|
||||
if (player)
|
||||
{
|
||||
if (PlayerInput.Pressed() && type == 0)
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
Hit(true);
|
||||
} else if (state.notPerfect())
|
||||
{
|
||||
Hit(false);
|
||||
}
|
||||
}
|
||||
if (PlayerInput.PressedUp() && type == 1)
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
Hit(true, type);
|
||||
} else if (state.notPerfect())
|
||||
{
|
||||
Hit(false, type);
|
||||
}
|
||||
}
|
||||
if (PlayerInput.Pressed())
|
||||
{
|
||||
if (!hasHit || (upcomingHits?.Count == 0 && startBeat == Single.MinValue))
|
||||
FanClub.instance.AngerOnMiss();
|
||||
|
||||
hasJumped = false;
|
||||
stopBeat = true;
|
||||
jumpStartTime = -99f;
|
||||
animator.Play("FanClap", 0, 0);
|
||||
Jukebox.PlayOneShotGame("fanClub/play_clap");
|
||||
Jukebox.PlayOneShotGame("fanClub/crap_impact");
|
||||
clappingStartTime = cond.songPositionInBeats;
|
||||
}
|
||||
if (PlayerInput.Pressing())
|
||||
{
|
||||
if (cond.songPositionInBeats > clappingStartTime + 1.5f && !stopCharge)
|
||||
{
|
||||
animator.Play("FanClapCharge", 0, 0);
|
||||
stopCharge = true;
|
||||
}
|
||||
}
|
||||
if (PlayerInput.PressedUp())
|
||||
{
|
||||
if (stopCharge)
|
||||
{
|
||||
if (!hasHit || (upcomingHits?.Count == 0 && startBeat == Single.MinValue))
|
||||
FanClub.instance.AngerOnMiss();
|
||||
|
||||
animator.Play("FanJump", 0, 0);
|
||||
Jukebox.PlayOneShotGame("fanClub/play_jump");
|
||||
jumpStartTime = cond.songPositionInBeats;
|
||||
stopCharge = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
animator.Play("FanFree", 0, 0);
|
||||
stopBeat = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float jumpPos = cond.GetPositionFromBeat(jumpStartTime, 1f);
|
||||
if (cond.songPositionInBeats >= jumpStartTime && cond.songPositionInBeats < jumpStartTime + 1f)
|
||||
{
|
||||
hasJumped = true;
|
||||
float yMul = jumpPos * 2f - 1f;
|
||||
float yWeight = -(yMul*yMul) + 1f;
|
||||
motionRoot.transform.localPosition = new Vector3(0, 3f * yWeight);
|
||||
shadow.transform.localScale = new Vector3((1f-yWeight*0.8f) * 1.4f, (1f-yWeight*0.8f) * 1.4f, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
motionRoot.transform.localPosition = new Vector3(0, 0);
|
||||
shadow.transform.localScale = new Vector3(1.4f, 1.4f, 1f);
|
||||
if (hasJumped && player)
|
||||
{
|
||||
animator.Play("FanPrepare", 0, 0);
|
||||
stopBeat = false;
|
||||
}
|
||||
hasJumped = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void ClapStart(bool hit, bool force = false, bool doCharge = false, bool fromAutoplay = false)
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
if (hit)
|
||||
{
|
||||
print("HIT");
|
||||
if (doCharge)
|
||||
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(cond.songPositionInBeats + 0.1f, delegate {
|
||||
if (PlayerInput.Pressing() || fromAutoplay)
|
||||
{
|
||||
animator.Play("FanClapCharge", 0, 0);
|
||||
stopCharge = true;
|
||||
}
|
||||
}),
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
print("missed");
|
||||
FanClub.instance.AngerOnMiss();
|
||||
}
|
||||
if (fromAutoplay || !force)
|
||||
{
|
||||
stopBeat = true;
|
||||
jumpStartTime = -99f;
|
||||
animator.Play("FanClap", 0, 0);
|
||||
Jukebox.PlayOneShotGame("fanClub/play_clap");
|
||||
Jukebox.PlayOneShotGame("fanClub/crap_impact");
|
||||
clappingStartTime = cond.songPositionInBeats;
|
||||
}
|
||||
if (fromAutoplay && !doCharge)
|
||||
{
|
||||
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(cond.songPositionInBeats + 0.1f, delegate {
|
||||
animator.Play("FanFree", 0, 0);
|
||||
stopBeat = false;
|
||||
}),
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void JumpStart(bool hit, bool force = false, bool fromAutoplay = false)
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
if (hit)
|
||||
{
|
||||
print("HIT");
|
||||
}
|
||||
else
|
||||
{
|
||||
print("missed");
|
||||
FanClub.instance.AngerOnMiss();
|
||||
}
|
||||
if (fromAutoplay || !force)
|
||||
{
|
||||
animator.Play("FanJump", 0, 0);
|
||||
Jukebox.PlayOneShotGame("fanClub/play_jump");
|
||||
jumpStartTime = cond.songPositionInBeats;
|
||||
stopCharge = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Bop()
|
||||
{
|
||||
if (!stopBeat)
|
||||
animator.Play("FanBeat", 0, 0);
|
||||
}
|
||||
|
||||
public void ClapParticle()
|
||||
{
|
||||
fanClapEffect.Play();
|
||||
}
|
||||
|
||||
public void MakeAngry(bool flip = false)
|
||||
{
|
||||
headAnimator.Play("FanFaceAngry", 0, 0);
|
||||
if (flip)
|
||||
{
|
||||
headRoot.transform.localScale = new Vector3(-1f, 1f, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/FanClub/NtrIdolFan.cs.meta
Normal file
11
Assets/Scripts/Games/FanClub/NtrIdolFan.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9446bd86cfdf08f4685a84d3c5348781
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
86
Assets/Scripts/Games/FanClub/NtrIdolInput.cs
Normal file
86
Assets/Scripts/Games/FanClub/NtrIdolInput.cs
Normal file
@ -0,0 +1,86 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_FanClub
|
||||
{
|
||||
public class NtrIdolInput : PlayerActionObject
|
||||
{
|
||||
public float startBeat;
|
||||
public int type;
|
||||
public bool doCharge = false;
|
||||
private bool hit = false;
|
||||
private bool hasHit = false;
|
||||
|
||||
void Start()
|
||||
{
|
||||
PlayerActionInit(gameObject, startBeat);
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
{
|
||||
Hit(true, type, true);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Conductor.instance.GetPositionFromBeat(startBeat, 1.25f) >= 1)
|
||||
{
|
||||
FanClub.instance.AngerOnMiss();
|
||||
CleanUp();
|
||||
}
|
||||
|
||||
if (!hit && Conductor.instance.GetPositionFromBeat(startBeat, 1) >= 1)
|
||||
{
|
||||
hit = true;
|
||||
if (hasHit) CleanUp();
|
||||
}
|
||||
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 1);
|
||||
StateCheck(normalizedBeat);
|
||||
|
||||
if (PlayerInput.Pressed() && type == 0)
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
Hit(true);
|
||||
} else if (state.notPerfect())
|
||||
{
|
||||
Hit(false);
|
||||
}
|
||||
}
|
||||
if (PlayerInput.PressedUp() && type == 1)
|
||||
{
|
||||
if (state.perfect)
|
||||
{
|
||||
Hit(true, type);
|
||||
} else if (state.notPerfect())
|
||||
{
|
||||
Hit(false, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Hit(bool _hit, int type = 0, bool fromAutoplay = false)
|
||||
{
|
||||
if (!hasHit)
|
||||
{
|
||||
if (type == 0)
|
||||
FanClub.instance.Player.ClapStart(_hit, true, doCharge, fromAutoplay);
|
||||
else if (type == 1)
|
||||
FanClub.instance.Player.JumpStart(_hit, true, fromAutoplay);
|
||||
|
||||
hasHit = true;
|
||||
|
||||
if (hit) CleanUp();
|
||||
}
|
||||
}
|
||||
|
||||
public void CleanUp()
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/FanClub/NtrIdolInput.cs.meta
Normal file
11
Assets/Scripts/Games/FanClub/NtrIdolInput.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d6294b6066d1254aa9d41878165a68e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -423,6 +423,26 @@ namespace HeavenStudio
|
||||
new Minigame("fireworks", "Fireworks \n<color=#eb5454>[WIP don't use]</color>", "000000", false, false, new List<GameAction>()
|
||||
{
|
||||
}),
|
||||
new Minigame("fanClub", "Fan Club \n<color=#eb5454>[WIP]</color>", "FDFD00", false, false, new List<GameAction>()
|
||||
{
|
||||
// TODO: proper names
|
||||
new GameAction("bop", delegate { FanClub.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 0.5f, true),
|
||||
// new GameAction("bop (spectators)", delegate { FanClub.instance.SpecBop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 0.5f, true),
|
||||
new GameAction("yeah, yeah, yeah", delegate { FanClub.instance.CallHai(eventCaller.currentEntity.beat); }, 8, false,
|
||||
// TODO: pre-switch cues
|
||||
inactiveFunction: delegate { FanClub.WarnHai(eventCaller.currentEntity.beat); }),
|
||||
new GameAction("I suppose", delegate { FanClub.instance.CallKamone(eventCaller.currentEntity.beat); }, 6, false,
|
||||
// TODO: pre-switch cues
|
||||
inactiveFunction: delegate { FanClub.WarnKamone(eventCaller.currentEntity.beat); }),
|
||||
|
||||
new GameAction("double clap", delegate { FanClub.instance.CallBigReady(eventCaller.currentEntity.beat); }, 4, false,
|
||||
// TODO: pre-switch cues
|
||||
inactiveFunction: delegate { FanClub.WarnBigReady(eventCaller.currentEntity.beat); }),
|
||||
new GameAction("play idol animation", delegate { var e = eventCaller.currentEntity; FanClub.instance.PlayAnim(e.beat, e.type); }, 0.5f, parameters: new List<Param>()
|
||||
{
|
||||
new Param("type", FanClub.IdolAnimations.Bop, "Animation", "Animation to play")
|
||||
}),
|
||||
}),
|
||||
/*new Minigame("spaceDance", "Space Dance", "B888F8", new List<GameAction>()
|
||||
{
|
||||
}),
|
||||
|
Reference in New Issue
Block a user