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:
ev
2023-03-26 23:09:55 -04:00
committed by GitHub
parent f2583d5414
commit e8aa00c5a8
191 changed files with 18835 additions and 17486 deletions

View File

@ -230,7 +230,7 @@ namespace HeavenStudio.Games
public void PlayPiano(float beat, float length, int semiTones)
{
var pianoPitch = Mathf.Pow(2f, (1f / 12f) * semiTones) *Conductor.instance.musicSource.pitch;
var pianoPitch = Jukebox.GetPitchFromSemiTones(semiTones, true);
var pianoSource = Jukebox.PlayOneShotGame("builtToScaleDS/Piano", -1, pianoPitch, 0.8f, true);
pianoSource.SetLoopParams(beat + length, 0.1f);

View File

@ -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
}
}

View File

@ -29,10 +29,7 @@ namespace HeavenStudio.Games.Scripts_FirstContact
//}
}
public void successTranslation(bool ace)
public void SuccessTranslation(bool ace)
{
if (ace)
{
@ -40,7 +37,7 @@ namespace HeavenStudio.Games.Scripts_FirstContact
//{
// Jukebox.PlayOneShotGame("firstContact/citrusRemix/1_r");
//}
Jukebox.PlayOneShotGame("firstContact/" + randomizerLines());
Jukebox.PlayOneShotGame("firstContact/" + RandomizerLines());
}
else
{
@ -53,7 +50,7 @@ namespace HeavenStudio.Games.Scripts_FirstContact
});
}
public void ehTranslation()
public void EhTranslation()
{
Jukebox.PlayOneShotGame("firstContact/slightlyFail");
BeatAction.New(this.gameObject, new List<BeatAction.Action>()
@ -62,9 +59,9 @@ namespace HeavenStudio.Games.Scripts_FirstContact
});
}
public int randomizerLines()
public int RandomizerLines()
{
return Random.Range(1, 11);
return Random.Range(1, 11);
}
}
}

View File

@ -25,48 +25,45 @@ public class WhiteLines : MonoBehaviour
void FixedUpdate()
{
if(transform.position.y > endAt && !isRandomLineMiddle)
if (transform.position.y > endAt && !isRandomLineMiddle)
{
transform.position += new Vector3(0, -speed * 1f, 0);
}
else if(transform.position.y <= endAt && !isRandomLineMiddle)
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)
if (rngEarlyGone > 0 && !isRandomLineMiddle)
{
line.color += new Color(1f, 1f, 1f, -0.01f);
if(line.color.a <= 0)
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);
transform.position = new Vector3(0, startAt, 0);
}
}
if (isRandomLineMiddle)
{
if(rngMiddleLine > 1 && !checkAnother)
{
if (rngMiddleLine > 1 && !checkAnother)
{
rngMiddleLine = Random.Range(0, 101);
}
if(rngMiddleLine <= 1)
if (rngMiddleLine <= 1)
{
line.color += new Color(1f, 1f, 1f, 0.01f);
checkAnother = true;
if(!checkOnce && line.color.a > .5f)
if (!checkOnce && line.color.a > .5f)
{
checkOnce = true;
}
}
if(checkOnce)
if (checkOnce)
{
line.color -= new Color(1f, 1f, 1f, 0.02f);
if (line.color.a <= 0)
@ -79,8 +76,6 @@ public class WhiteLines : MonoBehaviour
}
}
}
}
}

View File

@ -248,9 +248,9 @@ namespace HeavenStudio.Games
public void ForceSing(int semiTones, int semiTones1, int semiTonesPlayer)
{
leftChorusKid.currentPitch = Mathf.Pow(2f, (1f / 12f) * semiTones) * Conductor.instance.musicSource.pitch;
middleChorusKid.currentPitch = Mathf.Pow(2f, (1f / 12f) * semiTones1) * Conductor.instance.musicSource.pitch;
playerChorusKid.currentPitch = Mathf.Pow(2f, (1f / 12f) * semiTonesPlayer) * Conductor.instance.musicSource.pitch;
leftChorusKid.currentPitch = Jukebox.GetPitchFromSemiTones(semiTones, true);
middleChorusKid.currentPitch = Jukebox.GetPitchFromSemiTones(semiTones1, true);
playerChorusKid.currentPitch = Jukebox.GetPitchFromSemiTones(semiTonesPlayer, true);
leftChorusKid.StartSinging(true);
middleChorusKid.StartSinging(true);
if (!PlayerInput.Pressing() || GameManager.instance.autoplay) playerChorusKid.StartSinging(true);
@ -261,9 +261,9 @@ namespace HeavenStudio.Games
{
if (!playerChorusKid.disappeared) ScheduleInput(beat, 2.5f, InputType.STANDARD_UP, JustTogetherNow, Out, Out);
if (!playerChorusKid.disappeared) ScheduleInput(beat, 3.5f, InputType.STANDARD_DOWN, JustTogetherNowClose, MissBaton, Out);
float pitch = Mathf.Pow(2f, (1f / 12f) * semiTones) * Conductor.instance.musicSource.pitch;
float pitch1 = Mathf.Pow(2f, (1f / 12f) * semiTones1) * Conductor.instance.musicSource.pitch;
currentYellPitch = Mathf.Pow(2f, (1f / 12f) * semiTonesPlayer) * Conductor.instance.musicSource.pitch;
float pitch = Jukebox.GetPitchFromSemiTones(semiTones, true);
float pitch1 = Jukebox.GetPitchFromSemiTones(semiTones1, true);
currentYellPitch = Jukebox.GetPitchFromSemiTones(semiTonesPlayer, true);
MultiSound.Play(new MultiSound.Sound[]
{
new MultiSound.Sound("gleeClub/togetherEN-01", beat + 0.5f, conductorPitch),
@ -319,7 +319,7 @@ namespace HeavenStudio.Games
public void Sing(float beat, float length, int semiTones, int semiTones1, int semiTonesPlayer, int closeMouth, bool repeating, int semiTonesLeft2, int semiTonesLeft3, int semiTonesMiddle2)
{
float pitch = Mathf.Pow(2f, (1f / 12f) * semiTones) * Conductor.instance.musicSource.pitch;
float pitch = Jukebox.GetPitchFromSemiTones(semiTones, true);
if (!intervalStarted)
{
StartInterval(beat, length);
@ -351,17 +351,17 @@ namespace HeavenStudio.Games
if (!playerChorusKid.disappeared) ShowHeart(beat + length + beatInterval * 2 + 1);
foreach (var sing in queuedSingings)
{
float playerPitch = Mathf.Pow(2f, (1f / 12f) * sing.semiTonesPlayer) * Conductor.instance.musicSource.pitch;
float playerPitch = Jukebox.GetPitchFromSemiTones(sing.semiTonesPlayer, true);
if (!playerChorusKid.disappeared)
{
GleeClubSingInput spawnedInput = Instantiate(singInputPrefab, transform);
spawnedInput.pitch = playerPitch;
spawnedInput.Init(beat + length + sing.startBeat + beatInterval, sing.length, sing.closeMouth);
}
float pitch = Mathf.Pow(2f, (1f / 12f) * sing.semiTones) * Conductor.instance.musicSource.pitch;
float pitchLeft2 = Mathf.Pow(2f, (1f / 12f) * sing.semiTonesLeft2) * Conductor.instance.musicSource.pitch;
float pitchLeft3 = Mathf.Pow(2f, (1f / 12f) * sing.semiTonesLeft3) * Conductor.instance.musicSource.pitch;
float pitchMiddle2 = Mathf.Pow(2f, (1f / 12f) * sing.semiTonesMiddle2) * Conductor.instance.musicSource.pitch;
float pitch = Jukebox.GetPitchFromSemiTones(sing.semiTones, true);
float pitchLeft2 = Jukebox.GetPitchFromSemiTones(sing.semiTonesLeft2, true);
float pitchLeft3 = Jukebox.GetPitchFromSemiTones(sing.semiTonesLeft3, true);
float pitchMiddle2 = Jukebox.GetPitchFromSemiTones(sing.semiTonesMiddle2, true);
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + length + sing.startBeat, delegate

View File

@ -184,7 +184,7 @@ namespace HeavenStudio.Games
public RocketType type;
public float beat;
public float offSet;
public List<float> notes;
public List<int> notes;
}
private static List<QueuedRocket> queuedRockets = new List<QueuedRocket>();
@ -352,7 +352,7 @@ namespace HeavenStudio.Games
}
}
public void SpawnRocket(float beat, float beatOffset, RocketType type, List<float> notes)
public void SpawnRocket(float beat, float beatOffset, RocketType type, List<int> notes)
{
GameObject rocketToSpawn = rocket;
switch (type)
@ -372,7 +372,12 @@ namespace HeavenStudio.Games
}
GameObject spawnedRocket = Instantiate(rocketToSpawn, spawnPad, false);
var rocketScript = spawnedRocket.GetComponent<LaunchPartyRocket>();
rocketScript.pitches.AddRange(notes);
List<float> pitchedNotes = new List<float>();
foreach (var note in notes)
{
pitchedNotes.Add(Jukebox.GetPitchFromSemiTones(note, true));
}
rocketScript.pitches.AddRange(pitchedNotes);
switch (type)
{
case RocketType.Family:
@ -396,12 +401,12 @@ namespace HeavenStudio.Games
public static void LaunchRocket(float beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour)
{
List<float> pitches = new List<float>()
List<int> pitches = new List<int>()
{
Mathf.Pow(2f, (1f / 12f) * noteOne) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteTwo) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteThree) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteFour) * Conductor.instance.musicSource.pitch
noteOne,
noteTwo,
noteThree,
noteFour
};
if (GameManager.instance.currentGame == "launchParty")
{
@ -415,14 +420,14 @@ namespace HeavenStudio.Games
public static void LaunchPartyCracker(float beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix)
{
List<float> pitches = new List<float>()
List<int> pitches = new List<int>()
{
Mathf.Pow(2f, (1f / 12f) * noteOne) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteTwo) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteThree) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteFour) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteFive) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteSix) * Conductor.instance.musicSource.pitch,
noteOne,
noteTwo,
noteThree,
noteFour,
noteFive,
noteSix,
};
if (GameManager.instance.currentGame == "launchParty")
{
@ -436,17 +441,17 @@ namespace HeavenStudio.Games
public static void LaunchBell(float beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix, int noteSeven, int noteEight, int noteNine)
{
List<float> pitches = new List<float>()
List<int> pitches = new List<int>()
{
Mathf.Pow(2f, (1f / 12f) * noteOne) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteTwo) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteThree) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteFour) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteFive) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteSix) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteSeven) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteEight) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteNine) * Conductor.instance.musicSource.pitch,
noteOne,
noteTwo,
noteThree,
noteFour,
noteFive,
noteSix,
noteSeven,
noteEight,
noteNine
};
if (GameManager.instance.currentGame == "launchParty")
{
@ -461,23 +466,23 @@ namespace HeavenStudio.Games
public static void LaunchBowlingPin(float beat, float beatOffset, int noteOne, int noteTwo, int noteThree, int noteFour, int noteFive, int noteSix, int noteSeven,
int noteEight, int noteNine, int noteTen, int noteEleven, int noteTwelve, int noteThirteen, int noteFourteen, int noteFifteen)
{
List<float> pitches = new List<float>()
List<int> pitches = new List<int>()
{
Mathf.Pow(2f, (1f / 12f) * noteOne) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteTwo) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteThree) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteFour) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteFive) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteSix) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteSeven) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteEight) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteNine) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteTen) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteEleven) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteTwelve) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteThirteen) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteFourteen) * Conductor.instance.musicSource.pitch,
Mathf.Pow(2f, (1f / 12f) * noteFifteen) * Conductor.instance.musicSource.pitch,
noteOne,
noteTwo,
noteThree,
noteFour,
noteFive,
noteSix,
noteSeven,
noteEight,
noteNine,
noteTen,
noteEleven,
noteTwelve,
noteThirteen,
noteFourteen,
noteFifteen
};
if (GameManager.instance.currentGame == "launchParty")
{

View File

@ -159,6 +159,30 @@ namespace HeavenStudio.Util
source.KillLoop(fadeTime);
}
public static float GetPitchFromSemiTones(int semiTones, bool pitchToMusic)
{
if (pitchToMusic)
{
return Mathf.Pow(2f, (1f / 12f) * semiTones) * Conductor.instance.musicSource.pitch;
}
else
{
return Mathf.Pow(2f, (1f / 12f) * semiTones);
}
}
public static float GetPitchFromCents(int cents, bool pitchToMusic)
{
if (pitchToMusic)
{
return Mathf.Pow(2f, (1f / 12f) * (cents / 100)) * Conductor.instance.musicSource.pitch;
}
else
{
return Mathf.Pow(2f, (1f / 12f) * (cents / 100));
}
}
}
}