Merge branch 'master' into karate-man-2

This commit is contained in:
minenice55
2022-07-28 11:32:10 -04:00
594 changed files with 152282 additions and 7988 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8003568095ad4a9479dc75768215a6d0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,591 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using NaughtyBezierCurves;
using DG.Tweening;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Loaders
{
using static Minigames;
public static class RvlBadmintonLoader
{
public static Minigame AddGame(EventCaller e)
{
return new Minigame("airRally", "Air Rally", "008c97", false, false, new List<GameAction>()
{
new GameAction("set distance", delegate { AirRally.instance.SetDistance(e.currentEntity.type); }, .5f, false, new List<Param>()
{
new Param("type", AirRally.DistanceSound.close, "Type", "How far is Forthington?")
}),
//new GameAction("start rally", delegate { AirRally.instance.StartRally(true); }, .5f, false),
new GameAction("rally", delegate { AirRally.instance.Rally(e.currentEntity.beat, e.currentEntity.toggle, e.currentEntity.length); }, 2f, true, new List<Param>()
{
new Param("toggle", false, "Silent", "Make Forthington Silent"),
}),
new GameAction("ba bum bum bum", delegate { AirRally.instance.BaBumBumBum(e.currentEntity.beat, e.currentEntity.toggle, e.currentEntity.type); }, 7f, false, new List<Param>()
{
new Param("toggle", false, "Count", "Make Forthington Count"),
new Param("type", AirRally.DistanceSound.close, "Type", "How far is Forthington?")
}),
new GameAction("forthington voice lines", delegate { AirRally.instance.ForthVoice(e.currentEntity.type, e.currentEntity.type2); }, 1f, false, new List<Param>()
{
new Param("type", AirRally.CountSound.one, "Type", "The number Forthington will say"),
new Param("type", AirRally.DistanceSound.close, "Type", "How far is Forthington?")
}),
});
}
}
}
namespace HeavenStudio.Games
{
using Scripts_AirRally;
public class AirRally : Minigame
{
public static AirRally instance { get; set; }
[Header("Component")]
[SerializeField] GameObject Baxter;
[SerializeField] GameObject Forthington;
[SerializeField] GameObject Shuttlecock;
public GameObject ActiveShuttle;
[SerializeField] GameObject objHolder;
public DistanceSound e_BaBumState;
[Header("Tween")]
Tween tweenForBaxter;
Tween tweenForForth;
[Header("Variables")]
public float serveBeat;
public bool started;
public bool served;
bool babum;
bool shuttleActive;
public bool hasMissed;
[Header("Waypoint")]
public float wayPointZForForth;
[Header("Curves")]
public BezierCurve3D closeRallyCurve;
public BezierCurve3D farRallyCurve;
public BezierCurve3D fartherRallyCurve;
public BezierCurve3D farthestRallyCurve;
public BezierCurve3D closeRallyReturnCurve;
[Header("Debug")]
public float beatShown;
public float lengthHolder;
public float lengthShown;
public int wantDistance;
public bool wantSilent;
public float beatHolder;
public Transform holderPos;
void Start()
{
Baxter.GetComponent<Animator>().Play("Idle");
Forthington.GetComponent<Animator>().Play("Idle");
}
private void Awake()
{
instance = this;
}
// Update is called once per frame
void Update()
{
if(PlayerInput.Pressed() && !IsExpectingInputNow())
{
Baxter.GetComponent<Animator>().Play("Hit");
Jukebox.PlayOneShotGame("airRally/whooshForth_Close", -1f);
}
var cond = Conductor.instance;
var currentBeat = cond.songPositionInBeats;
var hitBeat = serveBeat;
if (started)
{
if (!served)
{
hitBeat = serveBeat;
}
if(lengthHolder != lengthShown)
{
started = true;
//convert to 2 decimal places
var f = currentBeat;
//f = Mathf.Round(f * 10.0f) * 0.1f;
Rally(serveBeat + (int)f, wantSilent, lengthHolder);
//Debug.Log("Beat Loop: " + serveBeat + f);
//Debug.Log("Serve Beat: " + serveBeat);
}
}
}
public enum DistanceSound
{
close,
far,
farther,
farthest
}
public enum CountSound
{
one,
two,
three,
four
}
public void SpawnObject(float beat, int type)
{
BezierCurve3D curve = null;
switch (type)
{
case (int)DistanceSound.close:
curve = closeRallyCurve;
break;
case (int)DistanceSound.far:
curve = farRallyCurve;
break;
case (int)DistanceSound.farther:
curve = fartherRallyCurve;
break;
case (int)DistanceSound.farthest:
curve = farthestRallyCurve;
break;
}
//curve.KeyPoints[0].transform.position = new Vector3(holderPos.position.x, holderPos.position.y, wayPointZForForth);
if (!shuttleActive)
{
ActiveShuttle = GameObject.Instantiate(Shuttlecock, objHolder.transform);
ActiveShuttle.AddComponent<Shuttlecock>();
}
var shuttleScript = ActiveShuttle.GetComponent<Shuttlecock>();
shuttleScript.flyPos = 0f;
shuttleScript.isReturning = false;
shuttleScript.startBeat = (int)Conductor.instance.songPositionInBeats;
shuttleScript.curve = curve;
//float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(beat, 3f);
//ActiveShuttle.transform.position = curve.GetPoint(normalizedBeatAnim);
ActiveShuttle.transform.rotation = Quaternion.Euler(0, 0, 0);
ActiveShuttle.SetActive(true);
shuttleActive = true;
}
public void ReturnObject(float beat, int type)
{
BezierCurve3D curve = null;
switch (type)
{
case (int)DistanceSound.close:
curve = closeRallyCurve;
break;
case (int)DistanceSound.far:
curve = farRallyCurve;
break;
case (int)DistanceSound.farther:
curve = fartherRallyCurve;
break;
case (int)DistanceSound.farthest:
curve = farthestRallyCurve;
break;
}
ActiveShuttle.transform.localPosition = curve.KeyPoints[0].transform.position;
var shuttleScript = ActiveShuttle.GetComponent<Shuttlecock>();
shuttleScript.flyPos = 0f;
shuttleScript.isReturning = true;
shuttleScript.startBeat = beat;
//shuttleScript.curve = closeRallyReturnCurve;
//float normalizedBeatAnim = Conductor.instance.GetPositionFromBeat(beat, 3f);
//ActiveShuttle.transform.position = curve.GetPoint(normalizedBeatAnim);
ActiveShuttle.transform.rotation = Quaternion.Euler(0, 0, 0);
}
//change to something more optimized
public void ForthVoice(int type, int type2)
{
Forthington.GetComponent<Animator>().Play("TalkShort");
if (type == 0)
{
if(type2 == 0)
{
Jukebox.PlayOneShotGame("airRally/countIn1");
}
if(type2 == 1)
{
Jukebox.PlayOneShotGame("airRally/countIn1Far");
}
if(type2 == 2)
{
Jukebox.PlayOneShotGame("airRally/countIn1Farther");
}
if(type2 == 3)
{
Jukebox.PlayOneShotGame("airRally/countIn1Farthest");
}
}
if(type == 1)
{
if(type2 == 0)
{
Jukebox.PlayOneShotGame("airRally/countIn2");
}
if(type2 == 1)
{
Jukebox.PlayOneShotGame("airRally/countIn2Far");
}
if(type2 == 2)
{
Jukebox.PlayOneShotGame("airRally/countIn2Farther");
}
if(type2 == 3)
{
Jukebox.PlayOneShotGame("airRally/countIn2Farthest");
}
}
if(type == 2)
{
if(type2 == 0)
{
Jukebox.PlayOneShotGame("airRally/countIn3");
}
if(type2 == 1)
{
Jukebox.PlayOneShotGame("airRally/countIn3Far");
}
if(type2 == 2)
{
Jukebox.PlayOneShotGame("airRally/countIn3Farther");
}
if(type2 == 3)
{
Jukebox.PlayOneShotGame("airRally/countIn3Farthest");
}
}
if(type == 3)
{
if(type2 == 0)
{
Jukebox.PlayOneShotGame("airRally/countIn4");
}
if(type2 == 1)
{
Jukebox.PlayOneShotGame("airRally/countIn4Far");
}
if(type2 == 2)
{
Jukebox.PlayOneShotGame("airRally/countIn4Farther");
}
if(type2 == 3)
{
Jukebox.PlayOneShotGame("airRally/countIn4Farthest");
}
}
}
public void SetDistance(int type)
{
switch (type)
{
case 0:
e_BaBumState = DistanceSound.close;
break;
case 1:
e_BaBumState = DistanceSound.far;
break;
case 2:
e_BaBumState = DistanceSound.farther;
break;
case 3:
e_BaBumState = DistanceSound.farthest;
break;
}
}
public void StartRally(bool start)
{
started = start;
}
public void Rally(float beat, bool silent, float length)
{
started = true;
beatShown = beat;
if (started)
{
wantSilent = silent;
serveBeat += 2f;
lengthHolder = length;
lengthShown += 2f;
beatHolder = beat;
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
//new BeatAction.Action(beat, delegate { Forthington.GetComponent<Animator>().Play("Ready");} ),
new BeatAction.Action(beat, delegate { Forthington.GetComponent<Animator>().Play("Hit");} ),
//new BeatAction.Action(beat, delegate { SpawnObject(beat, (int)e_BaBumState); } ),
});
switch (e_BaBumState)
{
case DistanceSound.close:
wayPointZForForth = 3.55f;
tweenForForth = Forthington.gameObject.transform.DOMoveZ(wayPointZForForth, .15f);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { Baxter.GetComponent<Animator>().Play("CloseReady"); }),
new BeatAction.Action(beat, delegate { Jukebox.PlayOneShotGame("airRally/hitForth_Close"); }),
new BeatAction.Action(beat, delegate { if(!silent) { Jukebox.PlayOneShotGame("airRally/nya_Close"); } }),
new BeatAction.Action(beat + .25f, delegate { Jukebox.PlayOneShotGame("airRally/whooshForth_Close");}),
new BeatAction.Action(beat + 1f, delegate { if(!babum) { Forthington.GetComponent<Animator>().Play("Ready"); } }),
});
break;
case DistanceSound.far:
wayPointZForForth = 35.16f;
tweenForForth = Forthington.gameObject.transform.DOMoveZ(wayPointZForForth, .15f);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { Baxter.GetComponent<Animator>().Play("FarReady"); }),
new BeatAction.Action(beat, delegate { Jukebox.PlayOneShotGame("airRally/hitForth_Far"); }),
new BeatAction.Action(beat, delegate { if(!silent) { Jukebox.PlayOneShotGame("airRally/nya_Far"); } }),
new BeatAction.Action(beat + .25f, delegate { Jukebox.PlayOneShotGame("airRally/whooshForth_Far");}),
new BeatAction.Action(beat + 1f, delegate { if(!babum) { Forthington.GetComponent<Animator>().Play("Ready"); } }),
});
break;
case DistanceSound.farther:
wayPointZForForth = 105.16f;
tweenForForth = Forthington.gameObject.transform.DOMoveZ(wayPointZForForth, .15f);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { Baxter.GetComponent<Animator>().Play("FarReady"); }),
new BeatAction.Action(beat, delegate { Jukebox.PlayOneShotGame("airRally/hitForth_Farther"); }),
new BeatAction.Action(beat, delegate { if(!silent) { Jukebox.PlayOneShotGame("airRally/nya_Farther"); } }),
new BeatAction.Action(beat + .25f, delegate { Jukebox.PlayOneShotGame("airRally/whooshForth_Farther");}),
new BeatAction.Action(beat + 1f, delegate { if(!babum) { Forthington.GetComponent<Animator>().Play("Ready"); } }),
});
break;
case DistanceSound.farthest:
wayPointZForForth = 255.16f;
tweenForForth = Forthington.gameObject.transform.DOMoveZ(wayPointZForForth, .15f);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { Baxter.GetComponent<Animator>().Play("FarReady"); }),
new BeatAction.Action(beat, delegate { Jukebox.PlayOneShotGame("airRally/hitForth_Farthest"); }),
new BeatAction.Action(beat, delegate { if(!silent) { Jukebox.PlayOneShotGame("airRally/nya_Farthest"); } }),
new BeatAction.Action(beat + .25f, delegate { Jukebox.PlayOneShotGame("airRally/whooshForth_Farthest");}),
new BeatAction.Action(beat + 1f, delegate { if(!babum) { Forthington.GetComponent<Animator>().Play("Ready"); } }),
});
break;
}
//SpawnObject(beat, (int)e_BaBumState);
ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, RallyOnHit, RallyOnMiss, RallyEmpty);
//restart rally
if (lengthShown == lengthHolder || lengthShown >= lengthHolder)
{
serveBeat = 0f;
lengthShown = 0f;
lengthHolder = 0f;
}
}
}
public void BaBumBumBum(float beat, bool count, int type)
{
//This feels wrong, will keep until I figure out what's wrong
babum = true;
serveBeat = 0f;
lengthShown = 0f;
lengthHolder = 0f;
//if (!ActiveShuttle)
//{
// SpawnObject(beat, (int)e_BaBumState);
//}
string[] sounds = { "", "", "", "", "", ""};
string[] sounds2 = { "", "", "" };
if (e_BaBumState == DistanceSound.close || type == 0)
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2.5f, delegate { Baxter.GetComponent<Animator>().Play("CloseReady");})
});
sounds[0] = "airRally/baBumBumBum_Close1";
sounds[1] = "airRally/baBumBumBum_Close2";
sounds[2] = "airRally/baBumBumBum_Close3";
sounds[3] = "airRally/baBumBumBum_Close4";
sounds[4] = "airRally/hitForth_Close";
sounds[5] = "airRally/whooshForth_Close";
sounds2 = new string[] { "airRally/countIn2", "airRally/countIn3", "airRally/countIn4" };
}
if (e_BaBumState == DistanceSound.far || type == 1)
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2.5f, delegate { Baxter.GetComponent<Animator>().Play("FarReady");})
});
sounds[0] = "airRally/baBumBumBum_Far1";
sounds[1] = "airRally/baBumBumBum_Far2";
sounds[2] = "airRally/baBumBumBum_Far3";
sounds[3] = "airRally/baBumBumBum_Far4";
sounds[4] = "airRally/hitForth_Far";
sounds[5] = "airRally/whooshForth_Far";
sounds2 = new string[] { "airRally/countIn2Far", "airRally/countIn3Far", "airRally/countIn4Far" };
}
if (e_BaBumState == DistanceSound.farther || type == 2)
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2.5f, delegate { Baxter.GetComponent<Animator>().Play("FarReady");})
});
sounds[0] = "airRally/baBumBumBum_Farther1";
sounds[1] = "airRally/baBumBumBum_Farther2";
sounds[2] = "airRally/baBumBumBum_Farther3";
sounds[3] = "airRally/baBumBumBum_Farther4";
sounds[4] = "airRally/hitForth_Farther";
sounds[5] = "airRally/whooshForth_Farther";
sounds2 = new string[] { "airRally/countIn2Farther", "airRally/countIn3Farther", "airRally/countIn4Farther" };
}
if (e_BaBumState == DistanceSound.farthest || type == 3)
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2.5f, delegate { Baxter.GetComponent<Animator>().Play("FarthestReady");})
});
sounds[0] = "airRally/baBumBumBum_Farthest1";
sounds[1] = "airRally/baBumBumBum_Farthest2";
sounds[2] = "airRally/baBumBumBum_Farthest3";
sounds[3] = "airRally/baBumBumBum_Farthest4";
sounds[4] = "airRally/hitForth_Farthest";
sounds[5] = "airRally/whooshForth_Farthest";
sounds2 = new string[] { "airRally/countIn2Farthest", "airRally/countIn3Farthest", "airRally/countIn4Farthest" };
}
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 1.5f, delegate { Forthington.GetComponent<Animator>().Play("Ready"); }),
new BeatAction.Action(beat + 2.5f, delegate { if(babum) { Forthington.GetComponent<Animator>().Play("Hit"); } }),
new BeatAction.Action(beat + 3.5f, delegate { Forthington.GetComponent<Animator>().Play("TalkShort"); }),
new BeatAction.Action(beat + 4f, delegate { if(!count) Forthington.GetComponent<Animator>().Play("TalkShort"); }),
new BeatAction.Action(beat + 4.5f, delegate { Forthington.GetComponent<Animator>().Play("Ready"); }),
new BeatAction.Action(beat + 7f, delegate { if(babum) { babum = false; } }),
});
BeatAction.New(gameObject, new List<BeatAction.Action>() //MultiSound.Sound sounds weird
{
new BeatAction.Action(beat, delegate { Jukebox.PlayOneShotGame(sounds[0]); }),
new BeatAction.Action(beat + .5f, delegate { Jukebox.PlayOneShotGame(sounds[1]); }),
new BeatAction.Action(beat + 1.5f, delegate { Jukebox.PlayOneShotGame(sounds[2]); }),
new BeatAction.Action(beat + 2.5f, delegate { Jukebox.PlayOneShotGame(sounds[3]); }),
new BeatAction.Action(beat + 2.5f, delegate { Jukebox.PlayOneShotGame(sounds[4]); }),
new BeatAction.Action(beat + 3f, delegate { Jukebox.PlayOneShotGame(sounds[5]); }),
new BeatAction.Action(beat + 3.5f, delegate { if(e_BaBumState == DistanceSound.far) { Jukebox.PlayOneShotGame("airRally/whooshForth_Far2"); } }),
});
if (count)
{
var sound2 = new MultiSound.Sound[]
{
new MultiSound.Sound(sounds2[0], beat + 3.5f),
new MultiSound.Sound(sounds2[1], beat + 4.3f),
new MultiSound.Sound(sounds2[2], beat + 5.4f)
};
MultiSound.Play(sound2);
}
ScheduleInput(beat, 4.5f, InputType.STANDARD_DOWN, RallyOnHit, RallyOnMiss, RallyEmpty);
}
public void RallyOnHit(PlayerActionEvent caller, float beat)
{
Baxter.GetComponent<Animator>().Play("Hit");
hasMissed = false;
if (e_BaBumState == DistanceSound.close)
{
Jukebox.PlayOneShotGame("airRally/hitBaxter_Close");
}
if (e_BaBumState == DistanceSound.far)
{
Jukebox.PlayOneShotGame("airRally/hitBaxter_Far");
}
if (e_BaBumState == DistanceSound.farther)
{
Jukebox.PlayOneShotGame("airRally/hitBaxter_Farther");
}
if (e_BaBumState == DistanceSound.farthest)
{
Jukebox.PlayOneShotGame("airRally/hitBaxter_Farthest");
}
if (beatHolder % 2 == 0)
{
//ReturnObject(beatHolder + 1, 0);
//Debug.Log("a");
}
else
{
//ReturnObject(beatHolder + 1, 0);
//Debug.Log("b");
}
//Debug.Log("BeatHolder: " + beatHolder);
served = false;
}
public void RallyOnMiss(PlayerActionEvent caller)
{
served = false;
hasMissed = true;
shuttleActive = false;
}
public void RallyEmpty(PlayerActionEvent caller)
{
//empty
}
}
}

View File

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

View File

@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CircularMotion : MonoBehaviour
{
[SerializeField] float timeCounter = 0;
[SerializeField] Transform rootPos;
[SerializeField] float speed;
[SerializeField] float width;
[SerializeField] float height;
private void Start()
{
timeCounter = 0;
}
private void Update()
{
timeCounter += Time.deltaTime * speed;
float x = Mathf.Cos(timeCounter) * width + rootPos.position.x;
float y = Mathf.Sin(timeCounter) * height + rootPos.position.y;
float z = rootPos.position.z;
transform.position = new Vector3(x, y, z);
}
}

View File

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

View File

@ -0,0 +1,122 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using NaughtyBezierCurves;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Scripts_AirRally
{
public class Shuttlecock : PlayerActionObject
{
public float startBeat;
private float flyBeats;
public bool flyType;
bool miss = false;
public float flyPos;
public bool isReturning;
[NonReorderable] public BezierCurve3D curve;
AirRally game;
Vector3 nextPos;
private void Awake()
{
game = AirRally.instance;
flyBeats = 1f;
var cond = Conductor.instance;
flyPos = cond.GetPositionFromBeat(startBeat, flyBeats);
transform.position = curve.GetPoint(flyPos);
}
void Start()
{
}
// Update is called once per frame
void Update()
{
var cond = Conductor.instance;
//flyBeats = isReturning ? 1.2f : 1.2f;
float flyPos = cond.GetPositionFromBeat(startBeat, flyBeats);
if (flyPos <= 1f)
{
if (!miss)
{
flyPos *= .8f;
}
Vector3 lastPos = transform.position;
nextPos = curve.GetPoint(flyPos);
curve.KeyPoints[0].transform.position = new Vector3(game.holderPos.position.x, game.holderPos.position.y, game.wayPointZForForth);
if (isReturning)
{
curve.transform.localScale = new Vector3(-1, 1);
}
else
{
curve.transform.localScale = new Vector3(1, 1);
}
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
{
if (!isReturning)
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (360f * Time.deltaTime));
else
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (-360f * Time.deltaTime));
}
transform.position = nextPos;
}
//else
//{
// transform.position = curve.GetPoint(miss ? 1f : 0.95f);
//}
//if (flyPos > 1f)
//{
// if (Conductor.instance.GetPositionFromBeat(startBeat, flyBeats + 1f) >= 1f)
// {
// GameObject.Destroy(gameObject);
// return;
// }
//}
//if(flyPos > 1f)
//{
// if(Conductor.instance.GetPositionFromBeat(startBeat, flyBeats + 1f) >= 1f)
// {
// if (!isReturning)
// {
// curve = game.MissCurve;
// transform.position = curve.GetPoint(flyPos);
// }
// else
// {
// curve = game.MissReturnCurve;
// transform.position = curve.GetPoint(flyPos);
// }
// return;
// }
//}
if (game.hasMissed && flyPos > 1f)
{
if (Conductor.instance.GetPositionFromBeat(startBeat, flyBeats + 1f) >= 1f)
{
GameObject.Destroy(gameObject);
return;
}
}
}
}
}

View File

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

View File

@ -1,8 +1,8 @@
fileFormatVersion: 2
guid: fb2fdb673d6d1c34ab348b9c0da08705
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: fb2fdb673d6d1c34ab348b9c0da08705
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,376 +1,368 @@
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Loaders
{
using static Minigames;
public static class CtrFirstContact
{
public static Minigame AddGame(EventCaller eventCaller)
{
return new Minigame("firstContact", "First Contact", "008c97", false, false, new List<GameAction>()
{
new GameAction("beat intervals", delegate { FirstContact.instance.SetIntervalStart(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 4f, true),
new GameAction("alien speak", delegate { FirstContact.instance.alienSpeak(eventCaller.currentEntity.beat, eventCaller.currentEntity.valA); }, 0.5f, false, new List<Param>()
{
new Param("valA", new EntityTypes.Float(.8f, 1.5f, 1f), "Pitch")
}),
new GameAction("alien turnover", delegate { FirstContact.instance.alienTurnOver(eventCaller.currentEntity.beat); }, 0.5f, false),
new GameAction("alien success", delegate { FirstContact.instance.alienSuccess(eventCaller.currentEntity.beat); }, 1f, false),
new GameAction("mission control", delegate { FirstContact.instance.missionControlDisplay(eventCaller.currentEntity.beat, eventCaller.currentEntity.toggle, eventCaller.currentEntity.length); }, 1f, true, new List<Param>
{
new Param("toggle", false, "Stay", "If it's the end of the remix/song")
}),
new GameAction("look at", delegate { FirstContact.instance.lookAtDirection(eventCaller.currentEntity.type, eventCaller.currentEntity.type); }, .5f, false, new List<Param>()
{
new Param("type", FirstContact.alienLookAt.lookAtTranslator, "alien look at what", "[Alien] will look at what"),
new Param("type", FirstContact.translatorLookAt.lookAtAlien, "translator look at what", "[Translator] will look at what"),
}),
new GameAction("live bar beat", delegate { FirstContact.instance.liveBarBeat(eventCaller.currentEntity.toggle); }, .5f, false, new List<Param>()
{
new Param("toggle", true, "On Beat", "If the live bar animation will be on beat or not")
}),
//new GameAction("Version of First Contact", delegate { FirstContact.instance.versionOfFirstContact(eventCaller.currentEntity.type); }, .5f, false, new List<Param>
//{
// new Param("type", FirstContact.VersionOfContact.FirstContact, "Version", "Version of First Contact to play"),
//}),
});
}
}
}
namespace HeavenStudio.Games
{
//using Scripts_FirstContact;
public class FirstContact : Minigame
{
public static FirstContact instance { get; private set; }
[Header("Properties")]
public int alienSpeakCount;
public int translatorSpeakCount;
public bool hasMissed;
private float lastReportedBeat = 0;
[Header("Components")]
[SerializeField] GameObject alien;
[SerializeField] GameObject translator;
//[SerializeField] GameObject alienSpeech;
[SerializeField] GameObject dummyHolder;
[SerializeField] GameObject missionControl;
[SerializeField] GameObject liveBar;
[Header("Variables")]
public bool intervalStarted;
//float intervalStartBeat;
public float beatInterval = 4f;
public bool isCorrect, noHitOnce, isSpeaking;
//public int version;
public float lookAtLength = 1f;
bool onBeat;
float liveBarBeatOffset;
//public enum VersionOfContact
//{
// FirstContact,
// CitrusRemix,
// SecondContact
//}
public enum alienLookAt
{
lookAtTranslator,
idle
}
public enum translatorLookAt
{
lookAtAlien,
idle
}
private void Awake()
{
instance = this;
}
public void SetIntervalStart(float beat, float interval = 4f)
{
if (!intervalStarted)
{
//alienSpeakCount = 0;
//translatorSpeakCount = 0;
intervalStarted = true;
}
//intervalStartBeat = beat;
beatInterval = interval;
}
private void Update()
{
//This is taken from the conductor script
if (Conductor.instance.ReportBeat(ref lastReportedBeat, offset: liveBarBeatOffset))
{
liveBar.GetComponent<Animator>().Play("liveBar", 0, 0);
}
else if(Conductor.instance.songPositionInBeats < lastReportedBeat)
{
lastReportedBeat = Mathf.Round(Conductor.instance.songPositionInBeats);
}
if (PlayerInput.Pressed() && !IsExpectingInputNow() && !noHitOnce && !isSpeaking)
{
Jukebox.PlayOneShotGame("firstContact/" + randomizerLines());
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(.5f, delegate { translator.GetComponent<Animator>().Play("translator_speak", 0, 0);}),
});
}
if ((PlayerInput.Pressed() && !IsExpectingInputNow() && isSpeaking))
{
hasMissed = true;
}
}
//public void versionOfFirstContact(int type)
//{
// version = type;
//}
public void liveBarBeat(bool onBeat)
{
if (onBeat)
{
liveBarBeatOffset = 0;
}
else
{
liveBarBeatOffset = .5f;
}
}
public void lookAtDirection(int alienLookAt, int translatorLookAt)
{
Debug.Log(alienLookAt);
Debug.Log(translatorLookAt);
switch (alienLookAt)
{
case 0:
alien.GetComponent<Animator>().Play("alien_lookAt", 0, 0);
break;
case 1:
alien.GetComponent<Animator>().Play("alien_idle", 0, 0);
break;
}
switch (translatorLookAt)
{
case 0:
translator.GetComponent<Animator>().Play("translator_lookAtAlien", 0, 0);
break;
case 1:
translator.GetComponent<Animator>().Play("translator_idle", 0, 0);
break;
}
}
public void alienSpeak(float beat, float pitch)
{
Jukebox.PlayOneShotGame("firstContact/alien", beat, pitch);
++alienSpeakCount;
var random = Random.Range(0, 2);
string textToPut = "";
if(random == 0)
{
textToPut = "translator_lookAtAlien";
}
else
{
textToPut = "translator_lookAtAlien_nod";
}
ScheduleInput(beat, beatInterval, InputType.STANDARD_DOWN, alienTapping, alienOnMiss, AlienEmpty);
BeatAction.New(alien, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { alien.GetComponent<Animator>().Play("alien_talk", 0, 0); }),
new BeatAction.Action(beat, delegate
{
if (!isSpeaking)
{
translator.GetComponent<Animator>().Play(textToPut, 0, 0);
}
}),
});
}
public void alienTurnOver(float beat)
{
if (!intervalStarted)
{
SetIntervalStart(beat, beatInterval);
}
if (intervalStarted)
{
SetIntervalStart(beat, beatInterval);
}
Jukebox.PlayOneShotGame("firstContact/turnover");
BeatAction.New(alien, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { alien.GetComponent<Animator>().Play("alien_point", 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { alien.GetComponent<Animator>().Play("alien_idle", 0, 0); }),
new BeatAction.Action(beat + .5f,
delegate
{
if (!isSpeaking)
{
translator.GetComponent<Animator>().Play("translator_idle", 0, 0);
}
})
});
isSpeaking = true;
}
public void alienSuccess(float beat)
{
string[] sfxStrings = { "", "" };
string animString = "";
if (alienSpeakCount == translatorSpeakCount)
{
sfxStrings[0] = "firstContact/success_1";
sfxStrings[1] = "firstContact/success_2";
animString = "alien_success";
}
else if (alienSpeakCount != translatorSpeakCount)
{
sfxStrings[0] = "firstContact/failAlien_1";
sfxStrings[1] = "firstContact/failAlien_2";
animString = "alien_fail";
}
string[] sounds = new string[] { sfxStrings[0], sfxStrings[0] };
var sound = new MultiSound.Sound[]
{
new MultiSound.Sound(sounds[0], beat),
new MultiSound.Sound(sounds[1], beat + .5f)
};
MultiSound.Play(sound);
BeatAction.New(alien, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { alien.GetComponent<Animator>().Play(animString, 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { alien.GetComponent<Animator>().Play(animString, 0, 0); })
});
BeatAction.New(translator.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { translator.GetComponent<Animator>().Play("translator_idle", 0, 0); }),
});
alienSpeakCount = 0;
translatorSpeakCount = 0;
isSpeaking = false;
hasMissed = false;
noHitOnce = false;
}
public void missionControlDisplay(float beat, bool stay, float length)
{
missionControl.SetActive(true);
string textToPut = "";
if (alienSpeakCount == translatorSpeakCount)
{
textToPut = "missionControl_success";
}
else
{
textToPut = "missionControl_fail";
}
BeatAction.New(missionControl, new List<BeatAction.Action>()
{
new BeatAction.Action(length, delegate { missionControl.GetComponentInParent<Animator>().Play(textToPut, 0, 0); }),
new BeatAction.Action(length, delegate { alien.GetComponentInParent<Animator>().Play("alien_idle", 0, 0); }),
new BeatAction.Action(length, delegate { translator.GetComponent<Animator>().Play("translator_idle", 0, 0); }),
});
if (!stay)
{
BeatAction.New(missionControl, new List<BeatAction.Action>()
{
new BeatAction.Action(length, delegate { missionControl.SetActive(false); }),
});
}
else
{
missionControl.SetActive(true);
}
alienSpeakCount = 0;
translatorSpeakCount = 0;
isSpeaking = false;
}
public void alienTapping(PlayerActionEvent caller, float beat) //OnHit
{
if (!noHitOnce)
{
++translatorSpeakCount;
Jukebox.PlayOneShotGame("firstContact/" + randomizerLines());
isCorrect = true;
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(.5f, delegate { translator.GetComponent<Animator>().Play("translator_speak", 0, 0);}),
});
}
else if (noHitOnce)
{
Jukebox.PlayOneShotGame("firstContact/slightlyFail");
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(.5f, delegate { translator.GetComponent<Animator>().Play("translator_eh", 0, 0);}),
});
}
}
public void alienOnMiss(PlayerActionEvent caller) //OnMiss
{
if (!noHitOnce)
{
Jukebox.PlayOneShotGame("firstContact/alienNoHit");
noHitOnce = true;
}
BeatAction.New(alien, new List<BeatAction.Action>()
{
new BeatAction.Action(.5f, delegate { alien.GetComponent<Animator>().Play("alien_noHit", 0, 0); }),
});
}
public void AlienEmpty(PlayerActionEvent caller) //OnEmpty
{
//empty
}
public int randomizerLines()
{
return Random.Range(1, 11);
}
}
}
using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
namespace HeavenStudio.Games.Loaders
{
using static Minigames;
public static class CtrFirstContact
{
public static Minigame AddGame(EventCaller eventCaller)
{
return new Minigame("firstContact", "First Contact", "008c97", false, false, new List<GameAction>()
{
new GameAction("beat intervals", delegate { FirstContact.instance.SetIntervalStart(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 4f, true),
new GameAction("alien speak", delegate { FirstContact.instance.alienSpeak(eventCaller.currentEntity.beat, eventCaller.currentEntity.valA); }, 0.5f, false, new List<Param>()
{
new Param("valA", new EntityTypes.Float(.8f, 1.5f, 1f), "Pitch")
}),
new GameAction("alien turnover", delegate { FirstContact.instance.alienTurnOver(eventCaller.currentEntity.beat); }, 0.5f, false),
new GameAction("alien success", delegate { FirstContact.instance.alienSuccess(eventCaller.currentEntity.beat); }, 1f, false),
new GameAction("mission control", delegate { FirstContact.instance.missionControlDisplay(eventCaller.currentEntity.beat, eventCaller.currentEntity.toggle, eventCaller.currentEntity.length); }, 1f, true, new List<Param>
{
new Param("toggle", false, "Stay", "If it's the end of the remix/song")
}),
new GameAction("look at", delegate { FirstContact.instance.lookAtDirection(eventCaller.currentEntity.type, eventCaller.currentEntity.type); }, .5f, false, new List<Param>()
{
new Param("type", FirstContact.alienLookAt.lookAtTranslator, "alien look at what", "[Alien] will look at what"),
new Param("type", FirstContact.translatorLookAt.lookAtAlien, "translator look at what", "[Translator] will look at what"),
}),
new GameAction("live bar beat", delegate { FirstContact.instance.liveBarBeat(eventCaller.currentEntity.toggle); }, .5f, false, new List<Param>()
{
new Param("toggle", true, "On Beat", "If the live bar animation will be on beat or not")
}),
//new GameAction("Version of First Contact", delegate { FirstContact.instance.versionOfFirstContact(eventCaller.currentEntity.type); }, .5f, false, new List<Param>
//{
// new Param("type", FirstContact.VersionOfContact.FirstContact, "Version", "Version of First Contact to play"),
//}),
});
}
}
}
namespace HeavenStudio.Games
{
//using Scripts_FirstContact;
public class FirstContact : Minigame
{
public static FirstContact instance { get; private set; }
[Header("Properties")]
public int alienSpeakCount;
public int translatorSpeakCount;
public bool hasMissed;
private float lastReportedBeat = 0;
[Header("Components")]
[SerializeField] GameObject alien;
[SerializeField] GameObject translator;
//[SerializeField] GameObject alienSpeech;
[SerializeField] GameObject dummyHolder;
[SerializeField] GameObject missionControl;
[SerializeField] GameObject liveBar;
[Header("Variables")]
public bool intervalStarted;
//float intervalStartBeat;
public float beatInterval = 4f;
public bool isCorrect, noHitOnce, isSpeaking;
//public int version;
public float lookAtLength = 1f;
bool onBeat;
float liveBarBeatOffset;
//public enum VersionOfContact
//{
// FirstContact,
// CitrusRemix,
// SecondContact
//}
public enum alienLookAt
{
lookAtTranslator,
idle
}
public enum translatorLookAt
{
lookAtAlien,
idle
}
private void Awake()
{
instance = this;
}
public void SetIntervalStart(float beat, float interval)
{
if (!intervalStarted)
{
//alienSpeakCount = 0;
//translatorSpeakCount = 0;
intervalStarted = true;
}
//intervalStartBeat = beat;
beatInterval = interval;
}
private void Update()
{
//This is taken from the conductor script
if (Conductor.instance.ReportBeat(ref lastReportedBeat, offset: liveBarBeatOffset))
{
liveBar.GetComponent<Animator>().Play("liveBar", 0, 0);
}
else if(Conductor.instance.songPositionInBeats < lastReportedBeat)
{
lastReportedBeat = Mathf.Round(Conductor.instance.songPositionInBeats);
}
if (PlayerInput.Pressed() && !IsExpectingInputNow() && !noHitOnce && !isSpeaking && !missionControl.activeInHierarchy)
{
Jukebox.PlayOneShotGame("firstContact/" + randomizerLines());
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(.5f, delegate { translator.GetComponent<Animator>().Play("translator_speak", 0, 0);}),
});
}
if ((PlayerInput.Pressed() && !IsExpectingInputNow() && isSpeaking))
{
hasMissed = true;
}
}
//public void versionOfFirstContact(int type)
//{
// version = type;
//}
public void liveBarBeat(bool onBeat)
{
if (onBeat)
{
liveBarBeatOffset = 0;
}
else
{
liveBarBeatOffset = .5f;
}
}
public void lookAtDirection(int alienLookAt, int translatorLookAt)
{
Debug.Log(alienLookAt);
Debug.Log(translatorLookAt);
switch (alienLookAt)
{
case 0:
alien.GetComponent<Animator>().Play("alien_lookAt", 0, 0);
break;
case 1:
alien.GetComponent<Animator>().Play("alien_idle", 0, 0);
break;
}
switch (translatorLookAt)
{
case 0:
translator.GetComponent<Animator>().Play("translator_lookAtAlien", 0, 0);
break;
case 1:
translator.GetComponent<Animator>().Play("translator_idle", 0, 0);
break;
}
}
public void alienSpeak(float beat, float pitch)
{
Jukebox.PlayOneShotGame("firstContact/alien", beat, pitch);
++alienSpeakCount;
var random = Random.Range(0, 2);
string textToPut = "";
if(random == 0)
{
textToPut = "translator_lookAtAlien";
}
else
{
textToPut = "translator_lookAtAlien_nod";
}
ScheduleInput(beat, beatInterval, InputType.STANDARD_DOWN, alienTapping, alienOnMiss, AlienEmpty);
BeatAction.New(alien, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { alien.GetComponent<Animator>().Play("alien_talk", 0, 0); }),
new BeatAction.Action(beat, delegate
{
if (!isSpeaking)
{
translator.GetComponent<Animator>().Play(textToPut, 0, 0);
}
}),
});
}
public void alienTurnOver(float beat)
{
SetIntervalStart(beat, beatInterval);
Jukebox.PlayOneShotGame("firstContact/turnover");
BeatAction.New(alien, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { alien.GetComponent<Animator>().Play("alien_point", 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { alien.GetComponent<Animator>().Play("alien_idle", 0, 0); }),
new BeatAction.Action(beat + .5f,
delegate
{
if (!isSpeaking)
{
translator.GetComponent<Animator>().Play("translator_idle", 0, 0);
}
})
});
isSpeaking = true;
}
public void alienSuccess(float beat)
{
string[] sfxStrings = { "", "" };
string animString = "";
if (alienSpeakCount == translatorSpeakCount)
{
sfxStrings[0] = "firstContact/success_1";
sfxStrings[1] = "firstContact/success_2";
animString = "alien_success";
}
else if (alienSpeakCount != translatorSpeakCount)
{
sfxStrings[0] = "firstContact/failAlien_1";
sfxStrings[1] = "firstContact/failAlien_2";
animString = "alien_fail";
}
string[] sounds = new string[] { sfxStrings[0], sfxStrings[0] };
var sound = new MultiSound.Sound[]
{
new MultiSound.Sound(sounds[0], beat),
new MultiSound.Sound(sounds[1], beat + .5f)
};
MultiSound.Play(sound);
BeatAction.New(alien, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { alien.GetComponent<Animator>().Play(animString, 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { alien.GetComponent<Animator>().Play(animString, 0, 0); })
});
BeatAction.New(translator.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { translator.GetComponent<Animator>().Play("translator_idle", 0, 0); }),
});
alienSpeakCount = 0;
translatorSpeakCount = 0;
intervalStarted = false;
isSpeaking = false;
hasMissed = false;
noHitOnce = false;
}
public void missionControlDisplay(float beat, bool stay, float length)
{
missionControl.SetActive(true);
string textToPut = "";
if (alienSpeakCount == translatorSpeakCount)
{
textToPut = "missionControl_success";
}
else
{
textToPut = "missionControl_fail";
}
BeatAction.New(missionControl, new List<BeatAction.Action>()
{
new BeatAction.Action(length, delegate { missionControl.GetComponentInParent<Animator>().Play(textToPut, 0, 0); }),
new BeatAction.Action(length, delegate { alien.GetComponentInParent<Animator>().Play("alien_idle", 0, 0); }),
new BeatAction.Action(length, delegate { translator.GetComponent<Animator>().Play("translator_idle", 0, 0); }),
});
if (!stay)
{
BeatAction.New(missionControl, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + length, delegate { missionControl.SetActive(false); }),
});
}
else
{
missionControl.SetActive(true);
}
alienSpeakCount = 0;
translatorSpeakCount = 0;
isSpeaking = false;
}
public void alienTapping(PlayerActionEvent caller, float beat) //OnHit
{
if (!noHitOnce)
{
++translatorSpeakCount;
Jukebox.PlayOneShotGame("firstContact/" + randomizerLines());
isCorrect = true;
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(.5f, delegate { translator.GetComponent<Animator>().Play("translator_speak", 0, 0);}),
});
}
else if (noHitOnce)
{
Jukebox.PlayOneShotGame("firstContact/slightlyFail");
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(.5f, delegate { translator.GetComponent<Animator>().Play("translator_eh", 0, 0);}),
});
}
}
public void alienOnMiss(PlayerActionEvent caller) //OnMiss
{
if (!noHitOnce)
{
Jukebox.PlayOneShotGame("firstContact/alienNoHit");
noHitOnce = true;
}
BeatAction.New(alien, new List<BeatAction.Action>()
{
new BeatAction.Action(.5f, delegate { alien.GetComponent<Animator>().Play("alien_noHit", 0, 0); }),
});
}
public void AlienEmpty(PlayerActionEvent caller) //OnEmpty
{
//empty
}
public int randomizerLines()
{
return Random.Range(1, 11);
}
}
}

View File

@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ScrollForTap : MonoBehaviour
{
public float scrollSpeedX;
public float scrollSpeedY;
Vector3 startPos;
public float lengthX;
public float lengthY = 43.20976f;
private void Start()
{
startPos = transform.localPosition;
UpdatePos();
}
private void Update()
{
UpdatePos();
}
private void UpdatePos()
{
float newPosX = Mathf.Repeat(Time.time * scrollSpeedX, lengthX);
float newPosY = Mathf.Repeat(Time.time * scrollSpeedY, lengthY);
transform.localPosition = startPos + new Vector3(1 * newPosX, 1 * newPosY);
}
}

View File

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

View File

@ -1,6 +1,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using HeavenStudio.Util;
@ -19,8 +21,19 @@ namespace HeavenStudio.Games.Loaders
new GameAction("tap", delegate { TapTrial.instance.Tap(eventCaller.currentEntity.beat); }, 2.0f, false),
new GameAction("double tap", delegate { TapTrial.instance.DoubleTap(eventCaller.currentEntity.beat); }, 2.0f, false),
new GameAction("triple tap", delegate { TapTrial.instance.TripleTap(eventCaller.currentEntity.beat); }, 4.0f, false),
new GameAction("jump tap prep", delegate { TapTrial.instance.JumpTapPrep(eventCaller.currentEntity.beat); }, 1.0f, false),
new GameAction("jump tap", delegate { TapTrial.instance.JumpTap(eventCaller.currentEntity.beat); }, 2.0f, false),
new GameAction("final jump tap", delegate { TapTrial.instance.FinalJumpTap(eventCaller.currentEntity.beat); }, 2.0f, false),
new GameAction("scroll event", delegate { TapTrial.instance.scrollEvent(eventCaller.currentEntity.toggle, eventCaller.currentEntity.toggle); }, .5f, false, new List<Param>()
{
new Param("toggle", false, "Scroll FX", "Will scroll"),
new Param("toggle", false, "Flash FX", "Will flash to white"),
}),
new GameAction("giraffe events", delegate { TapTrial.instance.giraffeEvent(eventCaller.currentEntity.toggle, eventCaller.currentEntity.toggle); }, .5f, false, new List<Param>()
{
new Param("toggle", false, "Enter", "Giraffe will enter the scene"),
new Param("toggle", false, "Exit", "Giraffe will exit the scene"),
})
});
}
}
@ -29,15 +42,33 @@ namespace HeavenStudio.Games.Loaders
namespace HeavenStudio.Games
{
using Scripts_TapTrial;
using HeavenStudio.Common;
public class TapTrial : Minigame
{
[Header("References")]
public TapTrialPlayer player;
public GameObject tap;
//public GameObject tap;
[SerializeField] List<Animator> monkeys;
bool goBop;
[SerializeField] List<GameObject> monkey_roots;
[SerializeField] GameObject player_root;
//temporary
[SerializeField] List<GameObject> monkey_effects;
[SerializeField] List<GameObject> player_effects;
[SerializeField] Scroll scrollBG;
[SerializeField] SpriteRenderer flash;
[SerializeField] ScrollForTap scroll;
[SerializeField] GameObject giraffe;
bool goBop, isPrep;
float lastReportedBeat = 0f;
bool hasJumped, isFinalJump;
public float jumpStartTime = Single.MinValue;
float jumpPos;
public float time;
bool once;
public bool crIsRunning;
[SerializeField] GameObject bg;
bool giraffeIsIn;
public static TapTrial instance { get; set; }
@ -48,19 +79,54 @@ namespace HeavenStudio.Games
private void Update()
{
if (goBop)
{
if (goBop && !isPrep)
{
if (Conductor.instance.ReportBeat(ref lastReportedBeat))
{
monkeys[0].Play("Bop", 0, 0);
monkeys[1].Play("Bop", 0, 0);
player.anim.Play("Bop", 0, 0);
}
else if (Conductor.instance.songPositionInBeats < lastReportedBeat)
{
lastReportedBeat = Mathf.Round(Conductor.instance.songPositionInBeats);
}
}
jumpPos = Conductor.instance.GetPositionFromBeat(jumpStartTime, 1f);
if (Conductor.instance.songPositionInBeats >= jumpStartTime && Conductor.instance.songPositionInBeats < jumpStartTime + 1f)
{
float yMul = jumpPos * 2f - 1f;
float yWeight = -(yMul * yMul) + 1f;
monkey_roots[0].transform.localPosition = new Vector3(0, 1.5f * yWeight);
monkey_roots[1].transform.localPosition = new Vector3(0, 1.5f * yWeight);
if (!isFinalJump)
{
player_root.transform.localPosition = new Vector3(0f, 2.5f * yWeight);
}
else
{
player_root.transform.localPosition = new Vector3(0f, 3.5f * yWeight);
}
}
else
{
monkey_roots[0].transform.localPosition = new Vector3(0, 0);
monkey_roots[1].transform.localPosition = new Vector3(0, 0);
player_root.transform.localPosition = new Vector3(0, 0);
if (hasJumped)
{
//Jukebox.PlayOneShotGame("fanClub/landing_impact", pitch: UnityEngine.Random.Range(0.95f, 1f), volume: 1f / 4);
}
hasJumped = false;
}
if (PlayerInput.Pressed() && !IsExpectingInputNow())
{
player.anim.Play("Tap", 0, 0);
Jukebox.PlayOneShotGame("tapTrial/tonk");
}
}
public void Bop(bool isBopping)
@ -77,6 +143,7 @@ namespace HeavenStudio.Games
public void Tap(float beat)
{
isPrep = true;
Jukebox.PlayOneShotGame("tapTrial/ook");
player.anim.Play("TapPrepare", 0, 0);
@ -85,37 +152,21 @@ namespace HeavenStudio.Games
{
new BeatAction.Action(beat, delegate { monkeys[0].Play("TapPrepare"); }),
new BeatAction.Action(beat, delegate { monkeys[1].Play("TapPrepare"); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[0].Play("Tap"); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[0].Play("Tap"); particleEffectMonkeys(); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[1].Play("Tap"); }),
});
//CreateTap(beat);
ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, OnTap, OnTapMiss, OnEmpty);
}
public void OnTap(PlayerActionEvent caller, float beat)
{
Jukebox.PlayOneShotGame("tapTrial/tap");
player.anim.Play("Tap", 0, 0);
}
public void OnDoubleTap(PlayerActionEvent caller, float beat)
{
Jukebox.PlayOneShotGame("tapTrial/tap");
player.anim.Play("DoubleTap", 0, 0);
}
public void OnTapMiss(PlayerActionEvent caller)
{
}
public void OnEmpty(PlayerActionEvent caller)
{
//empty
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2f, delegate { isPrep = false; })
});
}
public void DoubleTap(float beat)
{
isPrep = true;
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("tapTrial/ookook", beat),
@ -128,10 +179,10 @@ namespace HeavenStudio.Games
{
new BeatAction.Action(beat, delegate { monkeys[0].Play("DoubleTapPrepare", 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { monkeys[0].Play("DoubleTapPrepare_2", 0, 0); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[0].Play("DoubleTap", 0, 0); }),
new BeatAction.Action(beat + 1.5f, delegate { monkeys[0].Play("DoubleTap", 0, 0); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[0].Play("DoubleTap", 0, 0); particleEffectMonkeys(); }),
new BeatAction.Action(beat + 1.5f, delegate { monkeys[0].Play("DoubleTap", 0, 0); particleEffectMonkeys(); }),
});
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { monkeys[1].Play("DoubleTapPrepare", 0, 0); }),
@ -140,19 +191,24 @@ namespace HeavenStudio.Games
new BeatAction.Action(beat + 1.5f, delegate { monkeys[1].Play("DoubleTap", 0, 0); }),
});
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 4f, delegate { isPrep = false; })
});
ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, OnDoubleTap, OnTapMiss, OnEmpty);
ScheduleInput(beat, 1.5f, InputType.STANDARD_DOWN, OnDoubleTap, OnTapMiss, OnEmpty);
}
public void TripleTap(float beat)
{
isPrep = true;
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("tapTrial/ooki1", beat),
new MultiSound.Sound("tapTrial/ooki2", beat + 0.5f)
});
//player.anim.Play("PosePrepare", 0, 0);
player.tripleOffset = 0;
BeatAction.New(gameObject, new List<BeatAction.Action>()
@ -166,7 +222,7 @@ namespace HeavenStudio.Games
new BeatAction.Action(beat, delegate { monkeys[0].Play("PostPrepare_1", 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { monkeys[0].Play("PostPrepare_2", 0, 0); }),
new BeatAction.Action(beat + 2f, delegate { monkeys[0].Play("PostTap", 0, 0); }),
new BeatAction.Action(beat + 2.5f, delegate { monkeys[0].Play("PostTap", 0, 0);}),
new BeatAction.Action(beat + 2.5f, delegate { monkeys[0].Play("PostTap_2", 0, 0); }),
new BeatAction.Action(beat + 3f, delegate { monkeys[0].Play("PostTap", 0, 0);}),
});
@ -175,35 +231,232 @@ namespace HeavenStudio.Games
new BeatAction.Action(beat, delegate { monkeys[1].Play("PostPrepare_1", 0, 0); }),
new BeatAction.Action(beat + .5f, delegate { monkeys[1].Play("PostPrepare_2", 0, 0); }),
new BeatAction.Action(beat + 2f, delegate { monkeys[1].Play("PostTap", 0, 0); }),
new BeatAction.Action(beat + 2.5f, delegate { monkeys[1].Play("PostTap", 0, 0);}),
new BeatAction.Action(beat + 2.5f, delegate { monkeys[1].Play("PostTap_2", 0, 0);}),
new BeatAction.Action(beat + 3f, delegate { monkeys[1].Play("PostTap", 0, 0);}),
});
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2f, delegate { particleEffectMonkeys(); }),
new BeatAction.Action(beat + 2.5f, delegate { particleEffectMonkeys(); }),
new BeatAction.Action(beat + 3f, delegate { particleEffectMonkeys(); }),
});
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, OnTripleTap, OnTapMiss, OnEmpty);
ScheduleInput(beat, 2.5f, InputType.STANDARD_DOWN, OnTripleTap, OnTapMiss, OnEmpty);
ScheduleInput(beat, 3f, InputType.STANDARD_DOWN, OnTripleTap, OnTapMiss, OnEmpty);
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, OnTap, OnTapMiss, OnEmpty);
ScheduleInput(beat, 2.5f, InputType.STANDARD_DOWN, OnDoubleTap, OnTapMiss, OnEmpty);
ScheduleInput(beat, 3f, InputType.STANDARD_DOWN, OnTap, OnTapMiss, OnEmpty);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 4f, delegate { isPrep = false; })
});
}
public void JumpTap(float beat)
{
isPrep = true;
hasJumped = true;
Jukebox.PlayOneShotGame("tapTrial/jumptap1");
player.anim.Play("JumpTap", 0, 0);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate {jumpStartTime = Conductor.instance.songPositionInBeats;}),
new BeatAction.Action(beat, delegate {monkeys[0].Play("JumpTap", 0, 0); }),
new BeatAction.Action(beat, delegate {monkeys[1].Play("JumpTap", 0, 0); }),
new BeatAction.Action(beat + 1f, delegate { particleEffectMonkeys(); }),
new BeatAction.Action(beat + 1f, delegate { particleEffectMonkeys_2(); }),
});
ScheduleInput(beat, .95f, InputType.STANDARD_DOWN, OnJumpTap, OnJumpTapMiss, OnEmpty); //why .95f? no idea, doesn't sound right w/ 1f
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2f, delegate { isPrep = false; })
});
}
public void JumpTapPrep(float beat)
{
isPrep = true;
monkeys[0].Play("JumpPrepare", 0, 0);
monkeys[1].Play("JumpPrepare", 0, 0);
player.anim.Play("JumpPrepare", 0, 0);
}
public void FinalJumpTap(float beat)
{
isPrep = true;
hasJumped = true;
isFinalJump = true;
Jukebox.PlayOneShotGame("tapTrial/jumptap2");
player.anim.Play("FinalJump");
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate {jumpStartTime = Conductor.instance.songPositionInBeats;}),
new BeatAction.Action(beat, delegate {monkeys[0].Play("Jump", 0, 0); }),
new BeatAction.Action(beat, delegate {monkeys[1].Play("Jump", 0, 0); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[0].Play("FinalJumpTap", 0, 0); particleEffectMonkeys(); particleEffectMonkeys_2(); }),
new BeatAction.Action(beat + 1f, delegate { monkeys[1].Play("FinalJumpTap", 0, 0); }),
});
ScheduleInput(beat, .95f, InputType.STANDARD_DOWN, OnJumpFinalTap, OnFinalJumpTapMiss, OnEmpty);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 2f, delegate { isPrep = false; })
});
}
public void CreateTap(float beat, int type = 0)
public void giraffeEvent(bool enter, bool exit)
{
GameObject _tap = Instantiate(tap);
_tap.transform.parent = tap.transform.parent;
_tap.SetActive(true);
Tap t = _tap.GetComponent<Tap>();
t.startBeat = beat;
t.type = type;
if (enter && !giraffeIsIn)
{
giraffe.SetActive(true);
giraffe.GetComponent<Animator>().Play("Enter", 0, 0);
giraffeIsIn = true;
}
else if (exit && giraffeIsIn)
{
giraffe.GetComponent<Animator>().Play("Exit", 0, 0);
giraffeIsIn = false;
}
}
public void scrollEvent(bool isScrolling, bool flashToWhite)
{
if (isScrolling)
{
if (!crIsRunning) // if coroutine is not running, play the following once
{
if (flashToWhite)
{
Sequence sequence = DOTween.Sequence();
sequence.Append(flash.DOColor(new Color(flash.color.r, flash.color.g, flash.color.b, .8f), 2f));
//sequence.Kill();
}
StartCoroutine(timer());
}
}
else //should be the reverse of the code above
{
scrollBG.enabled = false;
scrollBG.scrollSpeedY = 0;
}
}
#region Player Action Scripts
public void OnTap(PlayerActionEvent caller, float beat)
{
Jukebox.PlayOneShotGame("tapTrial/tap");
player.anim.Play("Tap", 0, 0);
player_effects[0].GetComponent<ParticleSystem>().Play();
}
public void OnDoubleTap(PlayerActionEvent caller, float beat)
{
Jukebox.PlayOneShotGame("tapTrial/tap");
player.anim.Play("DoubleTap", 0, 0);
player_effects[1].GetComponent<ParticleSystem>().Play();
}
public void OnTapMiss(PlayerActionEvent caller)
{
Jukebox.PlayOneShotGame("tapTrial/tapMonkey", pitch: 1.5f, volume: .3f);
}
public void OnJumpTapMiss(PlayerActionEvent caller)
{
Jukebox.PlayOneShotGame("tapTrial/tapMonkey", pitch: 1.5f, volume: .3f);
player.anim.Play("JumpTap_Miss", 0, 0);
}
public void OnFinalJumpTapMiss(PlayerActionEvent caller)
{
Jukebox.PlayOneShotGame("tapTrial/tapMonkey", pitch: 1.5f, volume: .3f);
player.anim.Play("FinalJump_Miss", 0, 0);
}
public void OnEmpty(PlayerActionEvent caller)
{
//empty
}
public void OnTripleTap(PlayerActionEvent caller, float beat)
{
if (player.tripleOffset % 2 == 0)
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { player.anim.Play("PoseTap_L", 0, 0); })
});
player.tripleOffset += 1;
}
else
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat, delegate { player.anim.Play("PoseTap_R", 0, 0); })
});
player.tripleOffset += 1;
}
player_effects[0].GetComponent<ParticleSystem>().Play();
Jukebox.PlayOneShotGame("tapTrial/tap");
}
public void OnJumpTap(PlayerActionEvent caller, float beat)
{
Jukebox.PlayOneShotGame("tapTrial/tap");
player.anim.Play("JumpTap_Success", 0, 0);
player_effects[0].GetComponent<ParticleSystem>().Play();
player_effects[1].GetComponent<ParticleSystem>().Play();
}
public void OnJumpFinalTap(PlayerActionEvent caller, float beat)
{
Jukebox.PlayOneShotGame("tapTrial/tap");
player.anim.Play("FinalJump_Tap");
player_effects[0].GetComponent<ParticleSystem>().Play();
player_effects[1].GetComponent<ParticleSystem>().Play();
isFinalJump = false;
}
#endregion
#region Misc. Functions
public void particleEffectMonkeys()
{
monkey_effects[0].GetComponent<ParticleSystem>().Play();
monkey_effects[1].GetComponent<ParticleSystem>().Play();
}
public void particleEffectMonkeys_2()
{
monkey_effects[2].GetComponent<ParticleSystem>().Play();
monkey_effects[3].GetComponent<ParticleSystem>().Play();
}
IEnumerator timer()
{
crIsRunning = true;
while (scroll.scrollSpeedY < 20)
{
scroll.scrollSpeedY += 5f;
yield return new WaitForSecondsRealtime(.5f);
}
}
#endregion
//this is the orig way for input handling
//public void CreateTap(float beat, int type = 0)
//{
// GameObject _tap = Instantiate(tap);
// _tap.transform.parent = tap.transform.parent;
// _tap.SetActive(true);
// Tap t = _tap.GetComponent<Tap>();
// t.startBeat = beat;
// t.type = type;
//}
}
}