mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 12:47:38 +02:00
Second Contact (#363)
* second contact sprites * Started rewriting * Sound stuff * foreigner textbox * default miss message * implement basic player textbox * transparency support for textbox refactor function labels to use C# convention * avoid double function call with mistranslation * add mistranslation textbox * fix logic with trailing translation * auto-positioning of translated text content * auto-hide textboxes on start * icon * Added two new helper functions for pitching with semitones and cents * All new sounds should be in now * bunch of visual fixes * Fixed stuff being innaccurate * Repeating voicelines begone! * Thump sound for bob man * Put an animator on the crowd * Fixed missing sprites * Fixed anim not playing sometimes on barely * Changed length of pass turn event from 0.5 to 1 beat long * Downscaled Sprites yippee * Auto look at * Fixed bob's textbox not appearing sometimes * Fixed some small things --------- Co-authored-by: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Co-authored-by: minenice55 <star.elementa@gmail.com> Co-authored-by: Seanski2 <seanbenedit@gmail.com>
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using HeavenStudio.Util;
|
||||
using TMPro;
|
||||
|
||||
namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
@ -9,37 +12,43 @@ namespace HeavenStudio.Games.Loaders
|
||||
{
|
||||
public static Minigame AddGame(EventCaller eventCaller)
|
||||
{
|
||||
return new Minigame("firstContact", "First Contact", "1f3833", false, false, new List<GameAction>()
|
||||
return new Minigame("firstContact", "Second Contact", "1f3833", false, false, new List<GameAction>()
|
||||
{
|
||||
new GameAction("beat intervals", "Start Interval")
|
||||
{
|
||||
function = delegate { FirstContact.instance.SetIntervalStart(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); },
|
||||
defaultLength = 4f,
|
||||
function = delegate { var e = eventCaller.currentEntity; FirstContact.instance.SetIntervalStart(e.beat, e.length, e["dialogue"]); },
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("dialogue", "REPLACE THIS", "Mistranslation Dialogue", "The line to use when messing up the translation")
|
||||
},
|
||||
defaultLength = 4f,
|
||||
resizable = true,
|
||||
priority = 1,
|
||||
priority = 2,
|
||||
},
|
||||
new GameAction("alien speak", "Alien Speak")
|
||||
new GameAction("alien speak", "Bob Speak")
|
||||
{
|
||||
function = delegate { FirstContact.instance.alienSpeak(eventCaller.currentEntity.beat, eventCaller.currentEntity["valA"]); },
|
||||
function = delegate { var e = eventCaller.currentEntity; FirstContact.instance.AlienSpeak(e.beat, e["dialogue"], e["spaceNum"]); },
|
||||
defaultLength = 0.5f,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Float(.8f, 1.5f, 1f), "Pitch")
|
||||
}
|
||||
new Param("spaceNum", new EntityTypes.Integer(0, 12, 0), "Amount of spaces", "Spaces to add before the untranslated icon"),
|
||||
new Param("dialogue", "", "Dialogue", "What should this sound translate to?")
|
||||
},
|
||||
priority = 1
|
||||
},
|
||||
new GameAction("alien turnover", "Alien Turnover")
|
||||
new GameAction("alien turnover", "Pass Turn")
|
||||
{
|
||||
function = delegate { FirstContact.instance.alienTurnOver(eventCaller.currentEntity.beat); },
|
||||
defaultLength = 0.5f,
|
||||
function = delegate { FirstContact.instance.AlienTurnOver(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); },
|
||||
resizable = true
|
||||
},
|
||||
new GameAction("alien success", "Confirm Response")
|
||||
new GameAction("alien success", "Success")
|
||||
{
|
||||
function = delegate { FirstContact.instance.alienSuccess(eventCaller.currentEntity.beat); },
|
||||
function = delegate { FirstContact.instance.AlienSuccess(eventCaller.currentEntity.beat); },
|
||||
},
|
||||
new GameAction("mission control", "Show Mission Control")
|
||||
{
|
||||
function = delegate { var e = eventCaller.currentEntity; FirstContact.instance.missionControlDisplay(e.beat, e["toggle"], e.length); },
|
||||
resizable = true,
|
||||
function = delegate { var e = eventCaller.currentEntity; FirstContact.instance.MissionControlDisplay(e.beat, e["toggle"], e.length); },
|
||||
resizable = true,
|
||||
parameters = new List<Param>
|
||||
{
|
||||
new Param("toggle", false, "Stay", "If it's the end of the remix/song")
|
||||
@ -47,28 +56,23 @@ namespace HeavenStudio.Games.Loaders
|
||||
},
|
||||
new GameAction("look at", "Look At")
|
||||
{
|
||||
function = delegate { FirstContact.instance.lookAtDirection(eventCaller.currentEntity["type"], eventCaller.currentEntity["type"]); },
|
||||
function = delegate { FirstContact.instance.LookAtDirection(eventCaller.currentEntity["type"], eventCaller.currentEntity["type2"]); },
|
||||
defaultLength = .5f,
|
||||
parameters = new List<Param>()
|
||||
{
|
||||
new Param("type", FirstContact.alienLookAt.lookAtTranslator, "alien look at what", "[Alien] will look at what"),
|
||||
new Param("type2", FirstContact.translatorLookAt.lookAtAlien, "translator look at what", "[Translator] will look at what"),
|
||||
new Param("type", FirstContact.alienLookAt.lookAtAlien, "Bob look at what", "[Bob] will look at what"),
|
||||
new Param("type2", FirstContact.translatorLookAt.lookAtBob, "Alien look at what", "[Alien] will look at what"),
|
||||
}
|
||||
},
|
||||
new GameAction("live bar beat", "Live Bar Beat")
|
||||
{
|
||||
function = delegate { FirstContact.instance.liveBarBeat(eventCaller.currentEntity["toggle"]); },
|
||||
function = delegate { FirstContact.instance.LiveBarBeat(eventCaller.currentEntity["toggle"]); },
|
||||
defaultLength = .5f,
|
||||
parameters = 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"),
|
||||
//}),
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -80,6 +84,11 @@ namespace HeavenStudio.Games
|
||||
|
||||
public class FirstContact : Minigame
|
||||
{
|
||||
const string MID_MSG_MISS = "<color=\"red\"> ..? </color>";
|
||||
const string MSG_ALIEN = "<sprite name=\"AlienIcn\">";
|
||||
const string MSG_MAN = "<sprite name=\"ManIcn\">";
|
||||
// I should add a DonkTroll sprite 🫰🫰🫰🫰🫰
|
||||
|
||||
public static FirstContact instance { get; private set; }
|
||||
|
||||
[Header("Properties")]
|
||||
@ -96,16 +105,37 @@ namespace HeavenStudio.Games
|
||||
[SerializeField] GameObject missionControl;
|
||||
[SerializeField] GameObject liveBar;
|
||||
|
||||
[SerializeField] GameObject alienTextbox;
|
||||
[SerializeField] TMP_Text alienText;
|
||||
[SerializeField] GameObject translateTextbox;
|
||||
[SerializeField] TMP_Text translateText;
|
||||
[SerializeField] GameObject translateFailTextbox;
|
||||
[SerializeField] TMP_Text translateFailText;
|
||||
|
||||
[Header("Variables")]
|
||||
int currentVoicelineIndex = -1;
|
||||
public bool intervalStarted;
|
||||
//float intervalStartBeat;
|
||||
float intervalStartBeat;
|
||||
public float beatInterval = 4f;
|
||||
public bool isCorrect, noHitOnce, isSpeaking;
|
||||
public bool noHitOnce, isSpeaking;
|
||||
//public int version;
|
||||
public float lookAtLength = 1f;
|
||||
bool onBeat;
|
||||
float liveBarBeatOffset;
|
||||
|
||||
string onOutDialogue = "YOU SUCK AT CHARTING";
|
||||
string callDiagBuffer = "";
|
||||
string respDiagBuffer = "";
|
||||
List<string> callDiagList = new List<string>();
|
||||
int callDiagIndex = 0;
|
||||
|
||||
|
||||
static List<QueuedSecondContactInput> queuedInputs = new List<QueuedSecondContactInput>();
|
||||
struct QueuedSecondContactInput
|
||||
{
|
||||
public float beatAwayFromStart;
|
||||
public string dialogue;
|
||||
}
|
||||
|
||||
//public enum VersionOfContact
|
||||
//{
|
||||
@ -116,23 +146,44 @@ namespace HeavenStudio.Games
|
||||
|
||||
public enum alienLookAt
|
||||
{
|
||||
lookAtTranslator,
|
||||
lookAtAlien,
|
||||
idle
|
||||
}
|
||||
|
||||
public enum translatorLookAt
|
||||
{
|
||||
lookAtAlien,
|
||||
lookAtBob,
|
||||
idle
|
||||
}
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
if (!Conductor.instance.isPlaying || Conductor.instance.isPaused)
|
||||
{
|
||||
if (queuedInputs.Count > 0) queuedInputs.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public void SetIntervalStart(float beat, float interval)
|
||||
private void Start()
|
||||
{
|
||||
callDiagBuffer = "";
|
||||
respDiagBuffer = "";
|
||||
callDiagList.Clear();
|
||||
callDiagIndex = 0;
|
||||
|
||||
alienTextbox.SetActive(false);
|
||||
translateTextbox.SetActive(false);
|
||||
translateFailTextbox.SetActive(false);
|
||||
}
|
||||
|
||||
public void SetIntervalStart(float beat, float interval, string outDialogue)
|
||||
{
|
||||
translator.GetComponent<Animator>().Play("translator_lookAtAlien", 0, 0);
|
||||
if (!intervalStarted)
|
||||
{
|
||||
//alienSpeakCount = 0;
|
||||
@ -140,42 +191,61 @@ namespace HeavenStudio.Games
|
||||
intervalStarted = true;
|
||||
}
|
||||
|
||||
//intervalStartBeat = beat;
|
||||
intervalStartBeat = beat;
|
||||
beatInterval = interval;
|
||||
|
||||
onOutDialogue = outDialogue;
|
||||
callDiagBuffer = "";
|
||||
respDiagBuffer = "";
|
||||
callDiagList.Clear();
|
||||
callDiagIndex = 0;
|
||||
|
||||
alienText.text = "";
|
||||
translateText.text = "";
|
||||
translateFailText.text = "";
|
||||
|
||||
alienTextbox.SetActive(false);
|
||||
translateTextbox.SetActive(false);
|
||||
translateFailTextbox.SetActive(false);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
//This is taken from the conductor script
|
||||
if (!Conductor.instance.isPlaying || Conductor.instance.isPaused)
|
||||
{
|
||||
if (queuedInputs.Count > 0) queuedInputs.Clear();
|
||||
}
|
||||
if (!Conductor.instance.isPlaying && !Conductor.instance.isPaused && intervalStarted)
|
||||
{
|
||||
intervalStarted = false;
|
||||
}
|
||||
if (Conductor.instance.ReportBeat(ref lastReportedBeat, offset: liveBarBeatOffset))
|
||||
{
|
||||
liveBar.GetComponent<Animator>().Play("liveBar", 0, 0);
|
||||
liveBar.GetComponent<Animator>().Play("liveBar", 0, 0);
|
||||
}
|
||||
else if(Conductor.instance.songPositionInBeats < lastReportedBeat)
|
||||
else if (Conductor.instance.songPositionInBeats < lastReportedBeat)
|
||||
{
|
||||
lastReportedBeat = Mathf.Round(Conductor.instance.songPositionInBeats);
|
||||
}
|
||||
|
||||
if (PlayerInput.Pressed() && !IsExpectingInputNow() && !noHitOnce && !isSpeaking && !missionControl.activeInHierarchy)
|
||||
if (PlayerInput.Pressed(true) && !IsExpectingInputNow(InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN))
|
||||
{
|
||||
Jukebox.PlayOneShotGame("firstContact/" + randomizerLines());
|
||||
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
|
||||
translator.GetComponent<Animator>().DoScaledAnimationAsync("translator_eh", 0.5f);
|
||||
if (isSpeaking)
|
||||
{
|
||||
new BeatAction.Action(.5f, delegate { translator.GetComponent<Animator>().Play("translator_speak", 0, 0);}),
|
||||
});
|
||||
}
|
||||
if ((PlayerInput.Pressed() && !IsExpectingInputNow() && isSpeaking))
|
||||
{
|
||||
hasMissed = true;
|
||||
if (callDiagIndex == 0)
|
||||
FailContact();
|
||||
else
|
||||
TrailingContact();
|
||||
}
|
||||
else if (!noHitOnce && !missionControl.activeInHierarchy)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("firstContact/ALIEN_PLAYER_MISS2_A", -1, Jukebox.GetPitchFromSemiTones(UnityEngine.Random.Range(-2, 1), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public void versionOfFirstContact(int type)
|
||||
//{
|
||||
// version = type;
|
||||
//}
|
||||
|
||||
public void liveBarBeat(bool onBeat)
|
||||
public void LiveBarBeat(bool onBeat)
|
||||
{
|
||||
if (onBeat)
|
||||
{
|
||||
@ -187,7 +257,7 @@ namespace HeavenStudio.Games
|
||||
}
|
||||
}
|
||||
|
||||
public void lookAtDirection(int alienLookAt, int translatorLookAt)
|
||||
public void LookAtDirection(int alienLookAt, int translatorLookAt)
|
||||
{
|
||||
Debug.Log(alienLookAt);
|
||||
Debug.Log(translatorLookAt);
|
||||
@ -210,114 +280,139 @@ namespace HeavenStudio.Games
|
||||
translator.GetComponent<Animator>().Play("translator_idle", 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void alienSpeak(float beat, float pitch)
|
||||
public void AlienSpeak(float beat, string dialogue, int spaceNum)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("firstContact/alien", beat, pitch);
|
||||
++alienSpeakCount;
|
||||
var random = Random.Range(0, 2);
|
||||
string textToPut = "";
|
||||
if(random == 0)
|
||||
queuedInputs.Add(new QueuedSecondContactInput()
|
||||
{
|
||||
textToPut = "translator_lookAtAlien";
|
||||
beatAwayFromStart = beat - intervalStartBeat,
|
||||
dialogue = dialogue
|
||||
});
|
||||
int voiceline = UnityEngine.Random.Range(1, 11);
|
||||
if (voiceline == currentVoicelineIndex) voiceline++;
|
||||
if (voiceline > 10) voiceline = 1;
|
||||
currentVoicelineIndex = voiceline;
|
||||
Jukebox.PlayOneShotGame("firstContact/Bob" + voiceline, beat, Jukebox.GetPitchFromCents(UnityEngine.Random.Range(-100, 0), false));
|
||||
Jukebox.PlayOneShotGame("firstContact/BobB");
|
||||
alien.GetComponent<Animator>().DoScaledAnimationAsync("alien_talk", 0.5f);
|
||||
if (UnityEngine.Random.Range(0, 5) == 0) translator.GetComponent<Animator>().DoScaledAnimationAsync("translator_lookAtAlien_nod", 0.5f);
|
||||
callDiagList.Add(dialogue);
|
||||
|
||||
alienTextbox.SetActive(true);
|
||||
for (int i = 0; i < spaceNum * 2; i++)
|
||||
{
|
||||
callDiagBuffer += " ";
|
||||
}
|
||||
callDiagBuffer += MSG_MAN;
|
||||
UpdateAlienTextbox();
|
||||
}
|
||||
|
||||
public void AlienTurnOver(float beat, float length)
|
||||
{
|
||||
if (queuedInputs.Count == 0) return;
|
||||
Jukebox.PlayOneShotGame("firstContact/turnover");
|
||||
alienTextbox.SetActive(false);
|
||||
alien.GetComponent<Animator>().Play("alien_point", 0, 0);
|
||||
|
||||
isSpeaking = true;
|
||||
intervalStarted = false;
|
||||
BeatAction.New(alien, new List<BeatAction.Action>()
|
||||
{
|
||||
new BeatAction.Action(beat + 0.5f, delegate { alien.GetComponent<Animator>().Play("alien_idle", 0, 0); })
|
||||
});
|
||||
if (!isSpeaking)
|
||||
{
|
||||
translator.GetComponent<Animator>().Play("translator_idle", 0, 0);
|
||||
}
|
||||
foreach (var input in queuedInputs)
|
||||
{
|
||||
ScheduleInput(beat, length + input.beatAwayFromStart, InputType.STANDARD_DOWN | InputType.DIRECTION_DOWN, AlienTapping, AlienOnMiss, AlienEmpty);
|
||||
}
|
||||
queuedInputs.Clear();
|
||||
}
|
||||
|
||||
public void AlienSuccess(float beat)
|
||||
{
|
||||
string animString = "";
|
||||
float secondSoundOffset = 0f;
|
||||
List<MultiSound.Sound> sound = new List<MultiSound.Sound>();
|
||||
if (!(hasMissed || noHitOnce))
|
||||
{
|
||||
sound = new List<MultiSound.Sound>()
|
||||
{
|
||||
new MultiSound.Sound("firstContact/successCrowd", beat),
|
||||
new MultiSound.Sound("firstContact/nod", beat),
|
||||
new MultiSound.Sound("firstContact/nod", beat + 0.5f),
|
||||
new MultiSound.Sound("firstContact/successExtra" + UnityEngine.Random.Range(1, 3), beat + 0.5f, Jukebox.GetPitchFromCents(UnityEngine.Random.Range(-50, 50), false)),
|
||||
new MultiSound.Sound("firstContact/whistle", beat + UnityEngine.Random.Range(0.5f, 1.5f), Jukebox.GetPitchFromCents(UnityEngine.Random.Range(-50, 100), false), UnityEngine.Random.Range(0.4f, 1f)),
|
||||
};
|
||||
animString = "alien_success";
|
||||
}
|
||||
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
|
||||
sound = new List<MultiSound.Sound>()
|
||||
{
|
||||
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";
|
||||
new MultiSound.Sound("firstContact/fail", beat),
|
||||
new MultiSound.Sound("firstContact/shakeHead", beat),
|
||||
new MultiSound.Sound("firstContact/shakeHead", beat + 0.5f),
|
||||
};
|
||||
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);
|
||||
MultiSound.Play(sound.ToArray());
|
||||
|
||||
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); })
|
||||
new BeatAction.Action(beat + .5f, delegate { alien.GetComponent<Animator>().Play(animString, 0, 0); }),
|
||||
new BeatAction.Action(beat + 1, delegate { alienTextbox.SetActive(false); translateTextbox.SetActive(false); translateFailTextbox.SetActive(false); })
|
||||
});
|
||||
|
||||
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)
|
||||
void UpdateAlienTextbox()
|
||||
{
|
||||
alienText.text = callDiagBuffer;
|
||||
}
|
||||
|
||||
void UpdateTranslateTextbox()
|
||||
{
|
||||
if (callDiagIndex == 0 && !hasMissed && !noHitOnce)
|
||||
{
|
||||
// shift the textbox to centre the message
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (string s in callDiagList)
|
||||
{
|
||||
sb.Append(s);
|
||||
}
|
||||
string fullMsg = sb.ToString();
|
||||
|
||||
// many hardcoded values there'll be a better way to do this
|
||||
Vector2 size = translateText.GetPreferredValues(fullMsg, 10.95f, 2);
|
||||
translateText.rectTransform.anchoredPosition = new Vector2(Mathf.Max((10.95f/2f) + (-size.x / 2 - 0.25f), -0.25f), Mathf.Max((2.11f / 2f) + (-size.y / 2) + 0.2f, 0.2f));
|
||||
}
|
||||
translateText.text = respDiagBuffer;
|
||||
translateFailText.text = respDiagBuffer;
|
||||
}
|
||||
|
||||
public void MissionControlDisplay(float beat, bool stay, float length)
|
||||
{
|
||||
missionControl.SetActive(true);
|
||||
|
||||
alienTextbox.SetActive(false);
|
||||
translateTextbox.SetActive(false);
|
||||
translateFailTextbox.SetActive(false);
|
||||
|
||||
string textToPut = "";
|
||||
|
||||
if (alienSpeakCount == translatorSpeakCount)
|
||||
if (!(hasMissed || noHitOnce))
|
||||
{
|
||||
textToPut = "missionControl_success";
|
||||
}
|
||||
@ -326,13 +421,9 @@ namespace HeavenStudio.Games
|
||||
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); }),
|
||||
|
||||
});
|
||||
missionControl.GetComponentInParent<Animator>().Play(textToPut, 0, 0);
|
||||
alien.GetComponentInParent<Animator>().Play("alien_idle", 0, 0);
|
||||
translator.GetComponent<Animator>().Play("translator_idle", 0, 0);
|
||||
|
||||
if (!stay)
|
||||
{
|
||||
@ -351,30 +442,75 @@ namespace HeavenStudio.Games
|
||||
isSpeaking = false;
|
||||
}
|
||||
|
||||
public void alienTapping(PlayerActionEvent caller, float beat) //OnHit
|
||||
void FailContact()
|
||||
{
|
||||
if (!noHitOnce)
|
||||
Jukebox.PlayOneShotGame("firstContact/failContact");
|
||||
translator.GetComponent<Animator>().DoScaledAnimationAsync("translator_speak", 0.5f);
|
||||
if (!hasMissed && callDiagIndex == 0)
|
||||
{
|
||||
++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);}),
|
||||
});
|
||||
translateFailTextbox.SetActive(true);
|
||||
respDiagBuffer = onOutDialogue;
|
||||
UpdateTranslateTextbox();
|
||||
ScoreMiss();
|
||||
}
|
||||
else if (noHitOnce)
|
||||
hasMissed = true;
|
||||
}
|
||||
|
||||
void TrailingContact()
|
||||
{
|
||||
Jukebox.PlayOneShotGame("firstContact/slightlyFail");
|
||||
translator.GetComponent<Animator>().Play("translator_eh", 0, 0);
|
||||
if (!hasMissed)
|
||||
{
|
||||
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);}),
|
||||
});
|
||||
respDiagBuffer += MID_MSG_MISS;
|
||||
UpdateTranslateTextbox();
|
||||
}
|
||||
hasMissed = true;
|
||||
}
|
||||
|
||||
public void AlienTapping(PlayerActionEvent caller, float state) //OnHit
|
||||
{
|
||||
if (hasMissed && callDiagIndex == 0)
|
||||
{
|
||||
caller.isEligible = false;
|
||||
ScoreMiss();
|
||||
return;
|
||||
};
|
||||
|
||||
if (noHitOnce)
|
||||
{
|
||||
caller.isEligible = false;
|
||||
FailContact();
|
||||
return;
|
||||
}
|
||||
|
||||
if (state >= 1f || state <= -1f)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("firstContact/ALIEN_PLAYER_A", -1, Jukebox.GetPitchFromSemiTones(UnityEngine.Random.Range(-3, 3), false));
|
||||
translator.GetComponent<Animator>().DoScaledAnimationAsync("translator_speak", 0.5f);
|
||||
if (callDiagIndex == 0) return;
|
||||
TrailingContact();
|
||||
return;
|
||||
}
|
||||
|
||||
translator.GetComponent<Animator>().DoScaledAnimationAsync("translator_speak", 0.5f);
|
||||
Jukebox.PlayOneShotGame("firstContact/ALIEN_PLAYER_A", -1, Jukebox.GetPitchFromSemiTones(UnityEngine.Random.Range(-3, 3), false));
|
||||
Jukebox.PlayOneShotGame("firstContact/ALIEN_PLAYER_B");
|
||||
if (hasMissed)
|
||||
{
|
||||
caller.isEligible = false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
respDiagBuffer += callDiagList[callDiagIndex];
|
||||
translateTextbox.SetActive(true);
|
||||
UpdateTranslateTextbox();
|
||||
callDiagIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
public void alienOnMiss(PlayerActionEvent caller) //OnMiss
|
||||
public void AlienOnMiss(PlayerActionEvent caller) //OnMiss
|
||||
{
|
||||
if (!noHitOnce)
|
||||
{
|
||||
@ -382,20 +518,16 @@ namespace HeavenStudio.Games
|
||||
noHitOnce = true;
|
||||
}
|
||||
|
||||
BeatAction.New(alien, new List<BeatAction.Action>()
|
||||
if (callDiagIndex > 0 && !hasMissed)
|
||||
{
|
||||
new BeatAction.Action(.5f, delegate { alien.GetComponent<Animator>().Play("alien_noHit", 0, 0); }),
|
||||
});
|
||||
respDiagBuffer += MID_MSG_MISS;
|
||||
UpdateTranslateTextbox();
|
||||
hasMissed = true;
|
||||
}
|
||||
|
||||
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 AlienEmpty(PlayerActionEvent caller) { } //OnEmpty
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user