mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 05:57:38 +02:00
Tram&Pauline
Animation mostly done perfectly
This commit is contained in:
8
Assets/Scripts/Games/FirstContact.meta
Normal file
8
Assets/Scripts/Games/FirstContact.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb2fdb673d6d1c34ab348b9c0da08705
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
113
Assets/Scripts/Games/FirstContact/AlienFirstContact.cs
Normal file
113
Assets/Scripts/Games/FirstContact/AlienFirstContact.cs
Normal file
@ -0,0 +1,113 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_FirstContact
|
||||
{
|
||||
public class AlienFirstContact : PlayerActionObject
|
||||
{
|
||||
public float createBeat;
|
||||
FirstContact game;
|
||||
Translator translator;
|
||||
bool hasSpoke;
|
||||
public float stateBeat;
|
||||
public bool prefabHolder;
|
||||
bool missed;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
game = FirstContact.instance;
|
||||
translator = GameObject.Find("Games/firstContact/Translator").GetComponent<Translator>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (hasSpoke)
|
||||
{
|
||||
return;
|
||||
}
|
||||
stateBeat = Conductor.instance.GetPositionFromMargin(createBeat + game.beatInterval, 1f);
|
||||
StateCheck(stateBeat);
|
||||
if (PlayerInput.Pressed(true))
|
||||
{
|
||||
if (state.eligible())
|
||||
{
|
||||
if (!game.hasMissed)
|
||||
{
|
||||
Ace();
|
||||
}
|
||||
else
|
||||
{
|
||||
Eh();
|
||||
}
|
||||
|
||||
}
|
||||
else if (state.notPerfect() && game.translatorSpeakCount > 0)
|
||||
{
|
||||
Eh();
|
||||
}
|
||||
//else if (stateBeat > Minigame.LateTime() && game.translatorSpeakCount == 0)
|
||||
//{
|
||||
// //Debug.Log("OW");
|
||||
// Miss();
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
if (stateBeat > Minigame.LateTime())
|
||||
{
|
||||
if (!missed)
|
||||
{
|
||||
MissNoHit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Ace()
|
||||
{
|
||||
translator.successTranslation(true);
|
||||
game.isCorrect = true;
|
||||
game.translatorSpeakCount++;
|
||||
hasSpoke = true;
|
||||
missed = false;
|
||||
}
|
||||
|
||||
public void Miss()
|
||||
{
|
||||
translator.successTranslation(false);
|
||||
game.isCorrect = false;
|
||||
hasSpoke = true;
|
||||
missed = false;
|
||||
}
|
||||
|
||||
|
||||
public void MissNoHit()
|
||||
{
|
||||
game.alienNoHit();
|
||||
game.isCorrect = false;
|
||||
missed = true;
|
||||
game.hasMissed = true;
|
||||
}
|
||||
|
||||
public void Eh()
|
||||
{
|
||||
translator.ehTranslation();
|
||||
hasSpoke = true;
|
||||
}
|
||||
|
||||
public override void OnAce()
|
||||
{
|
||||
Ace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
Assets/Scripts/Games/FirstContact/AlienFirstContact.cs.meta
Normal file
11
Assets/Scripts/Games/FirstContact/AlienFirstContact.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47ef82bd935047f42b39142f4a1b1d32
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
311
Assets/Scripts/Games/FirstContact/FirstContact.cs
Normal file
311
Assets/Scripts/Games/FirstContact/FirstContact.cs
Normal file
@ -0,0 +1,311 @@
|
||||
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); }, 0.5f, false),
|
||||
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); }, 1f, false, 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.type2); }, .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("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 = 0f;
|
||||
|
||||
[Header("Components")]
|
||||
[SerializeField] GameObject alien;
|
||||
[SerializeField] Translator 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;
|
||||
|
||||
//public enum VersionOfContact
|
||||
//{
|
||||
// FirstContact,
|
||||
// CitrusRemix,
|
||||
// SecondContact
|
||||
//}
|
||||
|
||||
public enum alienLookAt
|
||||
{
|
||||
lookAtTranslator,
|
||||
idle
|
||||
}
|
||||
|
||||
public enum translatorLookAt
|
||||
{
|
||||
lookAtAlien,
|
||||
idle
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
translator.Init();
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
//This is taken from the conductor script
|
||||
if (Conductor.instance.ReportBeat(ref lastReportedBeat))
|
||||
{
|
||||
liveBar.GetComponent<Animator>().Play("liveBar", 0, 0);
|
||||
}
|
||||
else if(Conductor.instance.songPositionInBeats < lastReportedBeat)
|
||||
{
|
||||
lastReportedBeat = Mathf.Round(Conductor.instance.songPositionInBeats);
|
||||
}
|
||||
}
|
||||
|
||||
//public void versionOfFirstContact(int type)
|
||||
//{
|
||||
// version = type;
|
||||
//}
|
||||
|
||||
public void lookAtDirection(int alienLookAt, int 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)
|
||||
{
|
||||
//if (!intervalStarted)
|
||||
//{
|
||||
// SetIntervalStart(beat, beatInterval);
|
||||
//}
|
||||
//missionControl.SetActive(false);
|
||||
Jukebox.PlayOneShotGame("firstContact/alien");
|
||||
|
||||
var random = Random.Range(0, 2);
|
||||
string textToPut = "";
|
||||
if(random == 0)
|
||||
{
|
||||
textToPut = "translator_lookAtAlien";
|
||||
}
|
||||
else
|
||||
{
|
||||
textToPut = "translator_lookAtAlien_nod";
|
||||
}
|
||||
|
||||
|
||||
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 { translator.GetComponent<Animator>().Play(textToPut, 0, 0); }),
|
||||
});
|
||||
|
||||
AlienFirstContact a = Instantiate(alienSpeech, dummyHolder.transform).GetComponent<AlienFirstContact>();
|
||||
a.GetComponent<AlienFirstContact>().createBeat = beat;
|
||||
alienSpeakCount++;
|
||||
}
|
||||
|
||||
public void alienTurnOver(float beat)
|
||||
{
|
||||
//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 { translator.GetComponent<Animator>().Play("translator_idle", 0, 0); })
|
||||
});
|
||||
|
||||
isSpeaking = true;
|
||||
}
|
||||
|
||||
public void SetIntervalStart(float beat, float interval = 4f)
|
||||
{
|
||||
if (!intervalStarted)
|
||||
{
|
||||
alienSpeakCount = 0;
|
||||
translatorSpeakCount = 0;
|
||||
intervalStarted = true;
|
||||
}
|
||||
|
||||
//intervalStartBeat = beat;
|
||||
beatInterval = interval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void alienSuccess(float beat)
|
||||
{
|
||||
//Make this codeblock smaller
|
||||
if (alienSpeakCount == translatorSpeakCount)
|
||||
{
|
||||
string[] sounds = new string[] { "firstContact/success_1", "firstContact/success_2" };
|
||||
var sound = new MultiSound.Sound[]
|
||||
{
|
||||
new MultiSound.Sound(sounds[0], beat),
|
||||
new MultiSound.Sound(sounds[1], beat + .5f, offset: .15f)
|
||||
};
|
||||
|
||||
MultiSound.Play(sound);
|
||||
|
||||
BeatAction.New(alien, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { alien.GetComponent<Animator>().Play("alien_success", 0, 0); }),
|
||||
new BeatAction.Action(beat + .5f, delegate { alien.GetComponent<Animator>().Play("alien_success", 0, 0); })
|
||||
});
|
||||
|
||||
BeatAction.New(translator.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { translator.GetComponent<Animator>().Play("translator_idle", 0, 0); }),
|
||||
});
|
||||
}
|
||||
else if (alienSpeakCount != translatorSpeakCount)
|
||||
{
|
||||
string[] sounds = new string[] { "firstContact/failAlien_1", "firstContact/failAlien_2" };
|
||||
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("alien_fail", 0, 0); }),
|
||||
new BeatAction.Action(beat + .5f, delegate { alien.GetComponent<Animator>().Play("alien_fail", 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 alienNoHit()
|
||||
{
|
||||
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 missionControlDisplay(float beat, bool stay)
|
||||
{
|
||||
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(beat, delegate { missionControl.GetComponentInParent<Animator>().Play(textToPut, 0, 0); }),
|
||||
new BeatAction.Action(beat, delegate { alien.GetComponentInParent<Animator>().Play("alien_idle", 0, 0); }),
|
||||
new BeatAction.Action(beat, delegate { translator.GetComponent<Animator>().Play("translator_idle", 0, 0); }),
|
||||
|
||||
});
|
||||
|
||||
if (!stay)
|
||||
{
|
||||
BeatAction.New(missionControl, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + 1f, delegate { missionControl.SetActive(false); }),
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
missionControl.SetActive(true);
|
||||
}
|
||||
|
||||
alienSpeakCount = 0;
|
||||
translatorSpeakCount = 0;
|
||||
isSpeaking = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
11
Assets/Scripts/Games/FirstContact/FirstContact.cs.meta
Normal file
11
Assets/Scripts/Games/FirstContact/FirstContact.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f2575369f43af4419d4d92d0de9e23b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
70
Assets/Scripts/Games/FirstContact/Translator.cs
Normal file
70
Assets/Scripts/Games/FirstContact/Translator.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using DG.Tweening;
|
||||
using HeavenStudio.Util;
|
||||
using Starpelly;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_FirstContact
|
||||
{
|
||||
public class Translator : PlayerActionObject
|
||||
{
|
||||
public Animator anim;
|
||||
|
||||
FirstContact game;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
game = FirstContact.instance;
|
||||
//anim = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
////IF YOU WANT TO PLAY NOTES ANYTIME W/O CONSTRAINTS
|
||||
//if (PlayerInput.Pressed(true) && !game.isSpeaking)
|
||||
//{
|
||||
// successTranslation(true);
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void successTranslation(bool ace)
|
||||
{
|
||||
if (ace)
|
||||
{
|
||||
//if(game.version == 1)
|
||||
//{
|
||||
// Jukebox.PlayOneShotGame("firstContact/citrusRemix/1_r");
|
||||
//}
|
||||
Jukebox.PlayOneShotGame("firstContact/" + randomizerLines());
|
||||
}
|
||||
else
|
||||
{
|
||||
Jukebox.PlayOneShotGame("firstContact/failContact");
|
||||
}
|
||||
|
||||
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(.5f, delegate { anim.Play("translator_speak", 0, 0);}),
|
||||
});
|
||||
}
|
||||
|
||||
public void ehTranslation()
|
||||
{
|
||||
Jukebox.PlayOneShotGame("firstContact/slightlyFail");
|
||||
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(.5f, delegate { anim.Play("translator_eh", 0, 0);}),
|
||||
});
|
||||
}
|
||||
|
||||
public int randomizerLines()
|
||||
{
|
||||
return Random.Range(1, 11);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/FirstContact/Translator.cs.meta
Normal file
11
Assets/Scripts/Games/FirstContact/Translator.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 090e2309a1a03314d93714e9c1ed5a99
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
86
Assets/Scripts/Games/FirstContact/WhiteLines.cs
Normal file
86
Assets/Scripts/Games/FirstContact/WhiteLines.cs
Normal file
@ -0,0 +1,86 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class WhiteLines : MonoBehaviour
|
||||
{
|
||||
float speed;
|
||||
float startAt = 4.80f;
|
||||
float endAt = -3.1f;
|
||||
[SerializeField] SpriteRenderer line;
|
||||
public int rngEarlyGone, rngMiddleLine;
|
||||
[SerializeField] bool isRandomLineMiddle;
|
||||
bool checkAnother, checkOnce;
|
||||
|
||||
void Start()
|
||||
{
|
||||
//speed = Random.Range(0.005f, 0.007f);
|
||||
speed = Random.Range(0.005f, 0.009f);
|
||||
rngEarlyGone = Random.Range(0, 5);
|
||||
if (isRandomLineMiddle)
|
||||
{
|
||||
rngMiddleLine = Random.Range(0, 101);
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if(transform.position.y > endAt && !isRandomLineMiddle)
|
||||
{
|
||||
transform.position += new Vector3(0, -speed * 1f, 0);
|
||||
}
|
||||
else if(transform.position.y <= endAt && !isRandomLineMiddle)
|
||||
{
|
||||
speed = Random.Range(0.005f, 0.009f);
|
||||
transform.position = new Vector3(0, startAt, 0);
|
||||
rngEarlyGone = Random.Range(0, 5);
|
||||
}
|
||||
|
||||
if(rngEarlyGone > 0 && !isRandomLineMiddle)
|
||||
{
|
||||
line.color += new Color(1f, 1f, 1f, -0.01f);
|
||||
if(line.color.a <= 0)
|
||||
{
|
||||
rngEarlyGone = Random.Range(0, 5);
|
||||
line.color = new Color(1f, 1f, 1f, .10f);
|
||||
transform.position = new Vector3(0, startAt, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (isRandomLineMiddle)
|
||||
{
|
||||
if(rngMiddleLine > 1 && !checkAnother)
|
||||
{
|
||||
rngMiddleLine = Random.Range(0, 101);
|
||||
}
|
||||
if(rngMiddleLine <= 1)
|
||||
{
|
||||
line.color += new Color(1f, 1f, 1f, 0.01f);
|
||||
checkAnother = true;
|
||||
|
||||
if(!checkOnce && line.color.a > .5f)
|
||||
{
|
||||
checkOnce = true;
|
||||
}
|
||||
}
|
||||
if(checkOnce)
|
||||
{
|
||||
line.color -= new Color(1f, 1f, 1f, 0.02f);
|
||||
if (line.color.a <= 0)
|
||||
{
|
||||
line.color = new Color(1f, 1f, 1f, 0f);
|
||||
rngMiddleLine = Random.Range(0, 101);
|
||||
transform.position = new Vector3(0, Random.Range(-1, 5));
|
||||
checkAnother = false;
|
||||
checkOnce = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/FirstContact/WhiteLines.cs.meta
Normal file
11
Assets/Scripts/Games/FirstContact/WhiteLines.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7756ed68ef3b4a468bd034afafba0cf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -23,17 +23,18 @@ namespace HeavenStudio.Games
|
||||
|
||||
public List<PlayerActionEvent> scheduledInputs = new List<PlayerActionEvent>();
|
||||
|
||||
/**
|
||||
* Schedule an Input for a later time in the minigame. Executes the methods put in parameters
|
||||
*
|
||||
* float startBeat : When the scheduling started (In beats)
|
||||
* float timer : How many beats later should the input be expected
|
||||
* InputType inputType : The type of the input that's expected (Press, release, A, B, Directions..) (Check InputType class for a list)
|
||||
* ActionEventCallbackState OnHit : Method to run if the Input has been Hit
|
||||
* ActionEventCallback OnMiss : Method to run if the Input has been Missed
|
||||
* ActionEventCallback OnBlank : Method to run whenever there's an Input while this is Scheduled (Shouldn't be used too much)
|
||||
*/
|
||||
public PlayerActionEvent ScheduleInput(float startBeat,
|
||||
/// <summary>
|
||||
/// Schedule an Input for a later time in the minigame. Executes the methods put in parameters
|
||||
/// </summary>
|
||||
/// <param name="startBeat">When the scheduling started (in beats)</param>
|
||||
/// <param name="timer">How many beats later should the input be expected</param>
|
||||
/// <param name="inputType">The type of the input that's expected (Press, Release, A, B, Directions>)</param>
|
||||
/// <param name="OnHit">Method to run if the Input has been Hit</param>
|
||||
/// <param name="OnMiss">Method to run if the Input has been Missed</param>
|
||||
/// <param name="OnBlank">Method to run whenever there's an Input while this is Scheduled (Shouldn't be used too much)</param>
|
||||
/// <returns></returns>
|
||||
public PlayerActionEvent ScheduleInput(
|
||||
float startBeat,
|
||||
float timer,
|
||||
InputType inputType,
|
||||
PlayerActionEvent.ActionEventCallbackState OnHit,
|
||||
@ -207,4 +208,4 @@ namespace HeavenStudio.Games
|
||||
return sameTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ namespace HeavenStudio.Games.Scripts_PajamaParty
|
||||
}
|
||||
),
|
||||
new BeatAction.Action(
|
||||
beat + 8f,
|
||||
beat + (longSleep ? 4f : 8f),
|
||||
delegate {
|
||||
canCharge = true;
|
||||
canJump = true;
|
||||
|
8
Assets/Scripts/Games/RhythmSomen.meta
Normal file
8
Assets/Scripts/Games/RhythmSomen.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4f027c28e1d79c4490cdb624dc5dc04
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
156
Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs
Normal file
156
Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs
Normal file
@ -0,0 +1,156 @@
|
||||
using HeavenStudio.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
using static Minigames;
|
||||
public static class PcoSomenLoader
|
||||
{
|
||||
public static Minigame AddGame(EventCaller eventCaller) {
|
||||
return new Minigame("rhythmSomen", "Rhythm Sōmen \n<color=#eb5454>[WIP don't use]</color>", "000000", false, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("crane (far)", delegate { RhythmSomen.instance.DoFarCrane(eventCaller.currentEntity.beat); }, 4.0f, false),
|
||||
new GameAction("crane (close)", delegate { RhythmSomen.instance.DoCloseCrane(eventCaller.currentEntity.beat); }, 3.0f, false),
|
||||
new GameAction("crane (both)", delegate { RhythmSomen.instance.DoBothCrane(eventCaller.currentEntity.beat); }, 4.0f, false),
|
||||
new GameAction("offbeat bell", delegate { RhythmSomen.instance.DoBell(eventCaller.currentEntity.beat); }, 1.0f, false),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace HeavenStudio.Games
|
||||
{
|
||||
// using Scripts_RhythmSomen;
|
||||
public class RhythmSomen : Minigame
|
||||
{
|
||||
public Animator SomenPlayer;
|
||||
public Animator FrontArm;
|
||||
public Animator EffectHit;
|
||||
public Animator EffectSweat;
|
||||
public Animator EffectExclam;
|
||||
public Animator EffectShock;
|
||||
public Animator CloseCrane;
|
||||
public Animator FarCrane;
|
||||
public GameObject Player;
|
||||
|
||||
public GameEvent bop = new GameEvent();
|
||||
|
||||
public static RhythmSomen instance;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
|
||||
{
|
||||
SomenPlayer.Play("HeadBob", -1, 0);
|
||||
}
|
||||
|
||||
if (PlayerInput.Pressed() && !IsExpectingInputNow())
|
||||
{
|
||||
Jukebox.PlayOneShotGame("rhythmSomen/somen_mistake");
|
||||
FrontArm.Play("ArmPluck", -1, 0);
|
||||
EffectSweat.Play("BlobSweating", -1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void DoFarCrane(float beat)
|
||||
{
|
||||
//Far Drop Multisound
|
||||
ScheduleInput(beat, 3f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty);
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("rhythmSomen/somen_lowerfar", beat),
|
||||
new MultiSound.Sound("rhythmSomen/somen_drop", beat + 1f),
|
||||
new MultiSound.Sound("rhythmSomen/somen_woosh", beat + 1.5f),
|
||||
});
|
||||
|
||||
BeatAction.New(Player, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { FarCrane.Play("Drop", -1, 0);}),
|
||||
new BeatAction.Action(beat + 1.0f, delegate { FarCrane.Play("Open", -1, 0);}),
|
||||
new BeatAction.Action(beat + 1.5f, delegate { FarCrane.Play("Lift", -1, 0);}),
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void DoCloseCrane(float beat)
|
||||
{
|
||||
//Close Drop Multisound
|
||||
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty);
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("rhythmSomen/somen_lowerclose", beat),
|
||||
new MultiSound.Sound("rhythmSomen/somen_drop", beat + 1f),
|
||||
new MultiSound.Sound("rhythmSomen/somen_woosh", beat + 1.5f),
|
||||
});
|
||||
|
||||
BeatAction.New(Player, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { CloseCrane.Play("DropClose", -1, 0);}),
|
||||
new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.Play("OpenClose", -1, 0);}),
|
||||
new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.Play("LiftClose", -1, 0);}),
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void DoBothCrane(float beat)
|
||||
{
|
||||
//Both Drop Multisound
|
||||
ScheduleInput(beat, 2f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty);
|
||||
ScheduleInput(beat, 3f, InputType.STANDARD_DOWN, CatchSuccess, CatchMiss, CatchEmpty);
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("rhythmSomen/somen_lowerfar", beat),
|
||||
new MultiSound.Sound("rhythmSomen/somen_doublealarm", beat),
|
||||
new MultiSound.Sound("rhythmSomen/somen_drop", beat + 1f),
|
||||
new MultiSound.Sound("rhythmSomen/somen_woosh", beat + 1.5f),
|
||||
});
|
||||
|
||||
BeatAction.New(Player, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { CloseCrane.Play("DropClose", -1, 0);}),
|
||||
new BeatAction.Action(beat, delegate { FarCrane.Play("Drop", -1, 0);}),
|
||||
new BeatAction.Action(beat + 1.0f, delegate { CloseCrane.Play("OpenClose", -1, 0);}),
|
||||
new BeatAction.Action(beat + 1.0f, delegate { FarCrane.Play("Open", -1, 0);}),
|
||||
new BeatAction.Action(beat + 1.5f, delegate { CloseCrane.Play("LiftClose", -1, 0);}),
|
||||
new BeatAction.Action(beat + 1.5f, delegate { FarCrane.Play("Lift", -1, 0);}),
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void DoBell(float beat)
|
||||
{
|
||||
//Bell Sound lol
|
||||
Jukebox.PlayOneShotGame("rhythmSomen/somen_bell");
|
||||
|
||||
BeatAction.New(Player, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat, delegate { EffectExclam.Play("ExclamAppear", -1, 0);}),
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void CatchSuccess(PlayerActionEvent caller, float state)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("rhythmSomen/somen_catch");
|
||||
FrontArm.Play("ArmPluck", -1, 0);
|
||||
EffectHit.Play("HitAppear", -1, 0);
|
||||
}
|
||||
|
||||
public void CatchMiss(PlayerActionEvent caller)
|
||||
{
|
||||
EffectShock.Play("ShockAppear", -1, 0);
|
||||
}
|
||||
|
||||
public void CatchEmpty(PlayerActionEvent caller)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs.meta
Normal file
11
Assets/Scripts/Games/RhythmSomen/RhythmSomen.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4384b197a2c57c64e80f2c6f10afdba2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -116,7 +116,7 @@ namespace HeavenStudio.Games
|
||||
{
|
||||
get
|
||||
{
|
||||
ColorUtility.TryParseHtmlString("#D8FFC1", out _defaultBgColor);
|
||||
ColorUtility.TryParseHtmlString("#A14FA1", out _defaultBgColor);
|
||||
return _defaultBgColor;
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using DG.Tweening;
|
||||
using NaughtyBezierCurves;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_NtrSamurai
|
||||
{
|
||||
public class NtrSamuraiChild : MonoBehaviour
|
||||
|
@ -5,9 +5,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using DG.Tweening;
|
||||
using NaughtyBezierCurves;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_NtrSamurai
|
||||
{
|
||||
public class NtrSamuraiObject : MonoBehaviour
|
||||
|
27
Assets/Scripts/Games/Tram&Pauline/Curtains.cs
Normal file
27
Assets/Scripts/Games/Tram&Pauline/Curtains.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_TramAndPauline
|
||||
{
|
||||
public class Curtains : MonoBehaviour
|
||||
{
|
||||
private Animator anim;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
11
Assets/Scripts/Games/Tram&Pauline/Curtains.cs.meta
Normal file
11
Assets/Scripts/Games/Tram&Pauline/Curtains.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e986f325614dad34f99276dcf3bd61ff
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
18
Assets/Scripts/Games/Tram&Pauline/Pauline.cs
Normal file
18
Assets/Scripts/Games/Tram&Pauline/Pauline.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Pauline : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/Tram&Pauline/Pauline.cs.meta
Normal file
11
Assets/Scripts/Games/Tram&Pauline/Pauline.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c9740a191998b7429be1f4ebee714f1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
18
Assets/Scripts/Games/Tram&Pauline/Tram.cs
Normal file
18
Assets/Scripts/Games/Tram&Pauline/Tram.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Tram : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/Tram&Pauline/Tram.cs.meta
Normal file
11
Assets/Scripts/Games/Tram&Pauline/Tram.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d9f0a0c395f5774abebc63146dd3534
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -3,20 +3,72 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
using static Minigames;
|
||||
public static class AgbTramLoader
|
||||
{
|
||||
public static Minigame AddGame(EventCaller eventCaller)
|
||||
{
|
||||
return new Minigame("tram&Pauline", "Tram&Pauline \n<color=#eb5454>[WIP don't use]</color>", "000000", false, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("curtains", delegate { TramAndPauline.instance.Curtains(eventCaller.currentEntity.beat); }, 0.5f),
|
||||
new GameAction("SFX", delegate { var e = eventCaller.currentEntity; TramAndPauline.instance.SFX(e.beat, e.toggle); }, 2.5f, false, new List<Param>()
|
||||
{
|
||||
new Param("type", TramAndPauline.SoundEffects.Henge, "calls", "the sound effects to choose from"),
|
||||
}),
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace HeavenStudio.Games
|
||||
{
|
||||
using Scripts_TramAndPauline;
|
||||
|
||||
public class TramAndPauline : Minigame
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
public enum CurtainState
|
||||
{
|
||||
Raised,
|
||||
Lower
|
||||
}
|
||||
|
||||
}
|
||||
public enum SoundEffects
|
||||
{
|
||||
Henge, //Shapeshift
|
||||
Henshin, //Transform
|
||||
Jump,
|
||||
Seino //One Two Three Go
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
}
|
||||
public static TramAndPauline instance;
|
||||
|
||||
[Header("Animators")]
|
||||
public Animator RaiseCurtains;
|
||||
public Animator LowerCurtains;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public void Curtains(float beat)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SFX(float beat, bool playSound)
|
||||
{
|
||||
playSound = false;
|
||||
var sound = new[]
|
||||
{
|
||||
new MultiSound.Sound("tram&Pauline/trampoline_unused_henge", beat),
|
||||
new MultiSound.Sound("tram&Pauline/trampoline_unused_henshin", beat + 1f),
|
||||
new MultiSound.Sound("tram&Pauline/trampoline_unused_jump", beat + 2f),
|
||||
new MultiSound.Sound("tram&Pauline/trampoline_unused_senio", beat + 3f)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8850749af64f82b44a728e2c273157e1
|
||||
guid: c993077b9c10749aabaa7f201b552653
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
18
Assets/Scripts/Games/Tram&Pauline/Trampoline.cs
Normal file
18
Assets/Scripts/Games/Tram&Pauline/Trampoline.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Trampoline : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/Tram&Pauline/Trampoline.cs.meta
Normal file
11
Assets/Scripts/Games/Tram&Pauline/Trampoline.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ac862c09eaeaa64083a07ef7ca089f4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Scripts/Games/TrickClass.meta
Normal file
8
Assets/Scripts/Games/TrickClass.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4365eafd06922a34eb4f69c2c020cc75
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
152
Assets/Scripts/Games/TrickClass/MobTrickObj.cs
Normal file
152
Assets/Scripts/Games/TrickClass/MobTrickObj.cs
Normal file
@ -0,0 +1,152 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using NaughtyBezierCurves;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_TrickClass
|
||||
{
|
||||
public class MobTrickObj : PlayerActionObject
|
||||
{
|
||||
public bool flyType;
|
||||
public float startBeat;
|
||||
bool miss = false;
|
||||
|
||||
float flyBeats;
|
||||
float dodgeBeats;
|
||||
public int type;
|
||||
|
||||
[NonSerialized] public BezierCurve3D curve;
|
||||
PlayerActionEvent hitProg;
|
||||
|
||||
private TrickClass game;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
game = TrickClass.instance;
|
||||
flyBeats = flyType ? 4f : 2f;
|
||||
dodgeBeats = flyType ? 2f : 1f;
|
||||
|
||||
var cond = Conductor.instance;
|
||||
|
||||
float flyPos = cond.GetPositionFromBeat(startBeat, flyBeats);
|
||||
transform.position = curve.GetPoint(flyPos);
|
||||
hitProg = game.ScheduleInput(startBeat, dodgeBeats, InputType.STANDARD_DOWN, DodgeJustOrNg, DodgeMiss, DodgeThrough);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
float flyPos = cond.GetPositionFromBeat(startBeat, flyBeats);
|
||||
|
||||
if (flyPos <= 1f)
|
||||
{
|
||||
if (!miss)
|
||||
{
|
||||
flyPos *= 0.95f;
|
||||
}
|
||||
Vector3 lastPos = transform.position;
|
||||
Vector3 nextPos = curve.GetPoint(flyPos);
|
||||
|
||||
if (flyType)
|
||||
{
|
||||
Vector3 direction = (nextPos - lastPos).normalized;
|
||||
float rotation = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
|
||||
this.transform.eulerAngles = new Vector3(0, 0, rotation);
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.rotation = Quaternion.Euler(0, 0, transform.rotation.eulerAngles.z + (360f * Time.deltaTime));
|
||||
}
|
||||
|
||||
transform.position = nextPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.position = curve.GetPoint(miss ? 1f : 0.95f);
|
||||
}
|
||||
|
||||
if (flyPos > 1f)
|
||||
{
|
||||
if (Conductor.instance.GetPositionFromBeat(startBeat, flyBeats + 1f) >= 1f)
|
||||
{
|
||||
GameObject.Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetDodgeSound()
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
return "trickClass/ball_impact";
|
||||
}
|
||||
}
|
||||
|
||||
public void DoObjMiss()
|
||||
{
|
||||
miss = true;
|
||||
switch (type)
|
||||
{
|
||||
case (int) TrickClass.TrickObjType.Plane:
|
||||
curve = game.planeMissCurve;
|
||||
flyBeats = 4f;
|
||||
|
||||
Vector3 lastPos = curve.GetPoint(0);
|
||||
Vector3 nextPos = curve.GetPoint(0.000001f);
|
||||
Vector3 direction = (nextPos - lastPos).normalized;
|
||||
float rotation = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
|
||||
this.transform.eulerAngles = new Vector3(0, 0, rotation);
|
||||
|
||||
transform.position = nextPos;
|
||||
break;
|
||||
default:
|
||||
curve = game.ballMissCurve;
|
||||
flyBeats = 1.25f;
|
||||
break;
|
||||
}
|
||||
startBeat += dodgeBeats;
|
||||
}
|
||||
|
||||
public void DodgeJustOrNg(PlayerActionEvent caller, float state)
|
||||
{
|
||||
if (game.playerCanDodge <= Conductor.instance.songPositionInBeats)
|
||||
{
|
||||
if (state <= -1f || state >= 1f)
|
||||
{
|
||||
//NG
|
||||
game.PlayerDodgeNg();
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound(GetDodgeSound(), startBeat + flyBeats, volume: 0.4f),
|
||||
});
|
||||
Jukebox.PlayOneShotGame(GetDodgeSound(), volume: 0.6f);
|
||||
Jukebox.PlayOneShot("miss");
|
||||
DoObjMiss();
|
||||
}
|
||||
else
|
||||
{
|
||||
//just
|
||||
game.PlayerDodge();
|
||||
Jukebox.PlayOneShotGame("trickClass/player_dodge_success", volume: 0.8f, pitch: UnityEngine.Random.Range(0.85f, 1.15f));
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound(GetDodgeSound(), startBeat + flyBeats, volume: 0.4f),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DodgeMiss(PlayerActionEvent caller)
|
||||
{
|
||||
Jukebox.PlayOneShotGame(GetDodgeSound());
|
||||
DoObjMiss();
|
||||
game.PlayerThrough();
|
||||
}
|
||||
|
||||
public void DodgeThrough(PlayerActionEvent caller) {}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/TrickClass/MobTrickObj.cs.meta
Normal file
11
Assets/Scripts/Games/TrickClass/MobTrickObj.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb420e9087e23a64eb3ca43a7620c211
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
194
Assets/Scripts/Games/TrickClass/TrickClass.cs
Normal file
194
Assets/Scripts/Games/TrickClass/TrickClass.cs
Normal file
@ -0,0 +1,194 @@
|
||||
using DG.Tweening;
|
||||
using NaughtyBezierCurves;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
using static Minigames;
|
||||
public static class MobTrickLoader
|
||||
{
|
||||
public static Minigame AddGame(EventCaller eventCaller) {
|
||||
return new Minigame("trickClass", "Trick on the Class\n<color=#eb5454>[WIP]</color>", "C0171D", false, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("toss", delegate
|
||||
{
|
||||
TrickClass.instance.TossObject(eventCaller.currentEntity.beat, eventCaller.currentEntity.type);
|
||||
}, 3, false, new List<Param>()
|
||||
{
|
||||
new Param("type", TrickClass.TrickObjType.Ball, "Object", "The object to toss")
|
||||
}),
|
||||
new GameAction("bop", delegate { var e = eventCaller.currentEntity; TrickClass.instance.Bop(e.beat, e.length); }, 1, true, hidden: true),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace HeavenStudio.Games
|
||||
{
|
||||
/**
|
||||
mob_Trick
|
||||
**/
|
||||
|
||||
using Scripts_TrickClass;
|
||||
public class TrickClass : Minigame
|
||||
{
|
||||
public enum TrickObjType {
|
||||
Ball,
|
||||
Plane,
|
||||
}
|
||||
|
||||
[Header("Objects")]
|
||||
public Animator playerAnim;
|
||||
public Animator girlAnim;
|
||||
public Animator warnAnim;
|
||||
|
||||
[Header("References")]
|
||||
public GameObject ballPrefab;
|
||||
public GameObject planePrefab;
|
||||
public GameObject shockPrefab;
|
||||
public Transform objHolder;
|
||||
|
||||
[Header("Curves")]
|
||||
public BezierCurve3D ballTossCurve;
|
||||
public BezierCurve3D ballMissCurve;
|
||||
public BezierCurve3D planeTossCurve;
|
||||
public BezierCurve3D planeMissCurve;
|
||||
public BezierCurve3D shockTossCurve;
|
||||
|
||||
public static TrickClass instance;
|
||||
public GameEvent bop = new GameEvent();
|
||||
|
||||
public float playerCanDodge = Single.MinValue;
|
||||
float playerBopStart = Single.MinValue;
|
||||
float girlBopStart = Single.MinValue;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var cond = Conductor.instance;
|
||||
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
|
||||
{
|
||||
if (cond.songPositionInBeats > playerBopStart)
|
||||
playerAnim.DoScaledAnimationAsync("Bop");
|
||||
|
||||
if (cond.songPositionInBeats > girlBopStart)
|
||||
girlAnim.DoScaledAnimationAsync("Bop");
|
||||
}
|
||||
|
||||
if (PlayerInput.Pressed() && !IsExpectingInputNow() && (playerCanDodge <= Conductor.instance.songPositionInBeats))
|
||||
{
|
||||
PlayerDodge(true);
|
||||
playerCanDodge = Conductor.instance.songPositionInBeats + 0.6f;
|
||||
}
|
||||
|
||||
// bruh
|
||||
var tossEvents = GameManager.instance.Beatmap.entities.FindAll(en => en.datamodel == "trickClass/toss");
|
||||
for (int i = 0; i < tossEvents.Count; i++)
|
||||
{
|
||||
var e = tossEvents[i];
|
||||
float timeToEvent = e.beat - cond.songPositionInBeats;
|
||||
warnAnim.Play("NoPose", -1, 0);
|
||||
if (timeToEvent > 0f && timeToEvent <= 1f)
|
||||
{
|
||||
string anim = "WarnBall";
|
||||
switch (e.type)
|
||||
{
|
||||
case (int) TrickObjType.Plane:
|
||||
anim = "WarnPlane";
|
||||
break;
|
||||
default:
|
||||
anim = "WarnBall";
|
||||
break;
|
||||
}
|
||||
warnAnim.DoScaledAnimation(anim, e.beat - 1f, 1f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Bop(float beat, float length)
|
||||
{
|
||||
bop.startBeat = beat;
|
||||
bop.length = length;
|
||||
}
|
||||
|
||||
public void TossObject(float beat, int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case (int) TrickObjType.Plane:
|
||||
Jukebox.PlayOneShotGame("trickClass/girl_toss_plane");
|
||||
break;
|
||||
default:
|
||||
Jukebox.PlayOneShotGame("trickClass/girl_toss_ball");
|
||||
break;
|
||||
}
|
||||
SpawnObject(beat, type);
|
||||
|
||||
girlAnim.DoScaledAnimationAsync("Throw");
|
||||
girlBopStart = Conductor.instance.songPositionInBeats + 0.75f;
|
||||
}
|
||||
|
||||
public void SpawnObject(float beat, int type)
|
||||
{
|
||||
GameObject objectToSpawn;
|
||||
BezierCurve3D curve;
|
||||
bool isPlane = false;
|
||||
switch (type)
|
||||
{
|
||||
case (int) TrickObjType.Plane:
|
||||
objectToSpawn = planePrefab;
|
||||
curve = planeTossCurve;
|
||||
isPlane = true;
|
||||
break;
|
||||
default:
|
||||
objectToSpawn = ballPrefab;
|
||||
curve = ballTossCurve;
|
||||
break;
|
||||
}
|
||||
var mobj = GameObject.Instantiate(objectToSpawn, objHolder);
|
||||
var thinker = mobj.GetComponent<MobTrickObj>();
|
||||
|
||||
thinker.startBeat = beat;
|
||||
thinker.flyType = isPlane;
|
||||
thinker.curve = curve;
|
||||
thinker.type = type;
|
||||
|
||||
mobj.SetActive(true);
|
||||
}
|
||||
|
||||
public void PlayerDodge(bool slow = false)
|
||||
{
|
||||
if (playerCanDodge > Conductor.instance.songPositionInBeats) return;
|
||||
|
||||
//anim
|
||||
Jukebox.PlayOneShotGame("trickClass/player_dodge");
|
||||
playerAnim.DoScaledAnimationAsync("Dodge", slow ? 0.6f : 1f);
|
||||
playerBopStart = Conductor.instance.songPositionInBeats + 0.75f;
|
||||
|
||||
}
|
||||
|
||||
public void PlayerDodgeNg()
|
||||
{
|
||||
playerAnim.DoScaledAnimationAsync("DodgeNg");
|
||||
playerBopStart = Conductor.instance.songPositionInBeats + 0.75f;
|
||||
playerCanDodge = Conductor.instance.songPositionInBeats + 0.15f;
|
||||
}
|
||||
|
||||
public void PlayerThrough()
|
||||
{
|
||||
playerAnim.DoScaledAnimationAsync("Through");
|
||||
playerBopStart = Conductor.instance.songPositionInBeats + 0.75f;
|
||||
playerCanDodge = Conductor.instance.songPositionInBeats + 0.15f;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Games/TrickClass/TrickClass.cs.meta
Normal file
11
Assets/Scripts/Games/TrickClass/TrickClass.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c32cb0e1f34c12c4f9440880fee8ff29
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user