mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 12:57:40 +02:00
First Contact - Updated Input Manager
Also changed the game icon w/ mask
This commit is contained in:
@ -37,7 +37,7 @@ namespace HeavenStudio.Games.Loaders
|
||||
|
||||
namespace HeavenStudio.Games
|
||||
{
|
||||
using Scripts_FirstContact;
|
||||
//using Scripts_FirstContact;
|
||||
|
||||
public class FirstContact : Minigame
|
||||
{
|
||||
@ -51,8 +51,8 @@ namespace HeavenStudio.Games
|
||||
|
||||
[Header("Components")]
|
||||
[SerializeField] GameObject alien;
|
||||
[SerializeField] Translator translator;
|
||||
[SerializeField] GameObject alienSpeech;
|
||||
[SerializeField] GameObject translator;
|
||||
//[SerializeField] GameObject alienSpeech;
|
||||
[SerializeField] GameObject dummyHolder;
|
||||
[SerializeField] GameObject missionControl;
|
||||
[SerializeField] GameObject liveBar;
|
||||
@ -65,6 +65,7 @@ namespace HeavenStudio.Games
|
||||
//public int version;
|
||||
public float lookAtLength = 1f;
|
||||
|
||||
|
||||
//public enum VersionOfContact
|
||||
//{
|
||||
// FirstContact,
|
||||
@ -87,7 +88,19 @@ namespace HeavenStudio.Games
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
translator.Init();
|
||||
}
|
||||
|
||||
public void SetIntervalStart(float beat, float interval = 4f)
|
||||
{
|
||||
if (!intervalStarted)
|
||||
{
|
||||
//alienSpeakCount = 0;
|
||||
//translatorSpeakCount = 0;
|
||||
intervalStarted = true;
|
||||
}
|
||||
|
||||
//intervalStartBeat = beat;
|
||||
beatInterval = interval;
|
||||
}
|
||||
|
||||
|
||||
@ -102,6 +115,19 @@ namespace HeavenStudio.Games
|
||||
{
|
||||
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)
|
||||
@ -141,7 +167,7 @@ namespace HeavenStudio.Games
|
||||
//}
|
||||
//missionControl.SetActive(false);
|
||||
Jukebox.PlayOneShotGame("firstContact/alien");
|
||||
|
||||
++alienSpeakCount;
|
||||
var random = Random.Range(0, 2);
|
||||
string textToPut = "";
|
||||
if(random == 0)
|
||||
@ -153,24 +179,26 @@ namespace HeavenStudio.Games
|
||||
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 { 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);
|
||||
//}
|
||||
if (!intervalStarted)
|
||||
{
|
||||
SetIntervalStart(beat, beatInterval);
|
||||
}
|
||||
if (intervalStarted)
|
||||
{
|
||||
SetIntervalStart(beat, beatInterval);
|
||||
}
|
||||
|
||||
Jukebox.PlayOneShotGame("firstContact/turnover");
|
||||
|
||||
@ -184,21 +212,6 @@ namespace HeavenStudio.Games
|
||||
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
|
||||
@ -254,20 +267,6 @@ namespace HeavenStudio.Games
|
||||
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);
|
||||
@ -306,6 +305,102 @@ namespace HeavenStudio.Games
|
||||
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);
|
||||
}
|
||||
|
||||
//public void alienSuccessTest(PlayerActionEvent caller, float beat)
|
||||
//{
|
||||
// string[] sfxStrings = { "", "" };
|
||||
// string animString = "";
|
||||
// float off = 0f;
|
||||
// if (alienSpeakCount == translatorSpeakCount)
|
||||
// {
|
||||
// sfxStrings[0] = "firstContact/success_1";
|
||||
// sfxStrings[1] = "firstContact/success_2";
|
||||
// animString = "alien_success";
|
||||
// off = .15f;
|
||||
// }
|
||||
// else if(alienSpeakCount != translatorSpeakCount)
|
||||
// {
|
||||
// sfxStrings[0] = "firstContact/failAlien_1";
|
||||
// sfxStrings[1] = "firstContact/failAlien_2";
|
||||
// animString = "alien_fail";
|
||||
// off = .5f;
|
||||
// }
|
||||
|
||||
// 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, offset: off)
|
||||
// };
|
||||
|
||||
// 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;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user