public static string StringifyMe() { string toReturn = ""; toReturn += ("Difficoltà: " + Difficulty + "\n"); toReturn += ("Sequenza: " + MagicOrchestraUtils.StringifySequence(Sequence) + "\n"); toReturn += ("Tempo proiezione: " + TimeInShowing + MagicOrchestraUtils.SecondsTextItalianSuffix(TimeInShowing) + "\n"); toReturn += ("Modalità gesture: " + MagicOrchestraUtils.TrueFalseConverter(IsGestureMode) + "\n"); if (!IsGestureMode) { toReturn += ("Tempo posizionamento: " + TimeInDetecting + MagicOrchestraUtils.SecondsTextItalianSuffix(TimeInDetecting) + "\n"); } if (MagicOrchestraParameters.IsContext) { toReturn += ("Modalità con piano: " + MagicOrchestraUtils.TrueFalseConverter(ShowPlane) + "\n"); } if (IsZenithOrthographic) { toReturn += ("Camera zenitale ortonormale\n"); } else { toReturn += ("Camera zenitale prospettica\n"); } toReturn += ("Suono di conferma: " + MagicOrchestraUtils.TrueFalseConverter(ConfirmSound) + "\n"); return(toReturn); }
/* <summary> * Update is called once per frame * </summary> */ void Update() { // If movement not on, i do not care about position if (!isMovementEnabled) { return; } // Looking to the nearest skelpos KinectBodySkeleton skel = MagicOrchestraUtils.GetNearestSkeleton(); if (skel == null) { Debug.Log("No MagicRoomKinectV2Manager founded"); return; } Vector3 skelpos = skel.SpineBase; // Computing new Vector3 position //tr.position = new Vector3(skelpos.x * 8 * _AdapterRoomSize.x + shiftX, gameObject.transform.position.y, (-6 + shiftY) * -_AdapterRoomSize.y - skelpos.z * 3.5f * _AdapterRoomSize.y); tr.position = new Vector3(multX * skelpos.x * 8 * _AdapterRoomSize.x + shiftX, gameObject.transform.position.y, (-6 + shiftY) * -_AdapterRoomSize.y * multY - skelpos.z * 3.5f * _AdapterRoomSize.y * multY); // Moving pillar on the game gameObject.transform.position = tr.position; }
/* <summary> * Called before return to MagicOrchestra scene * </summary> */ private void ReturnToHome(VideoPlayer videoPlayer) { // Stopping all the coroutines this.StopAllCoroutines(); // Checking if there are light to switch off if (MagicRoomLightManager.instance != null) { MagicOrchestraUtils.SwitchOffLightFeedback(); } switch (CutSceneParameters.TargetVideoIndex) { case 0: if (MagicOrchestraParameters.IsGuided) { CutSceneParameters.TargetVideoIndex = 5; SceneManager.LoadScene("BlackCutScenePlayer"); } else { MagicOrchestraParameters.GuidedOnPlay = false; MagicOrchestraParameters.LastGamePlayed = -1; SceneManager.LoadScene("MagicOrchestra"); } break; case 1: CutSceneParameters.TargetVideoIndex = 2; this.LoadVideo(); break; case 2: SceneManager.LoadScene("InstruMaps"); break; case 3: SceneManager.LoadScene("Game2"); break; case 4: SceneManager.LoadScene("CorsiTestScene"); break; case 5: MagicOrchestraParameters.GuidedOnPlay = false; MagicOrchestraParameters.LastGamePlayed = -1; SceneManager.LoadScene("MagicOrchestra"); break; default: MagicOrchestraParameters.GuidedOnPlay = false; MagicOrchestraParameters.LastGamePlayed = -1; SceneManager.LoadScene("MagicOrchestra"); break; } }
private void QuitGame() { MagicOrchestraUtils.SwitchOffLightFeedback(); #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else Application.Quit(); #endif }
public static string StringifyMe() { string toReturn = ""; toReturn += ("Difficoltà: " + Difficulty + "\n"); toReturn += ("Tempo proiezione frontale: " + TimeInShowing + " secondi\n"); toReturn += ("Suono di conferma: " + MagicOrchestraUtils.TrueFalseConverter(ConfirmSound) + "\n"); return(toReturn); }
public static void LogMe() { Debug.Log("Sequenza: " + MagicOrchestraUtils.StringifySequence(Sequence)); Debug.Log("Difficulty: " + Difficulty); Debug.Log("Modalità ordine inverso: " + IsReverse); Debug.Log("TimeInShowing: " + TimeInShowing); if (MagicOrchestraParameters.IsContext) { Debug.Log("Modalità Aiuto: " + isHintMode); Debug.Log("Modalità Shuffle: " + isShuffle); } Debug.Log("Suono di conferma:" + ConfirmSound); }
IEnumerator wrongAnswerCoroutine() { MagicOrchestraUtils.NegativeLightFeedback(); float waitTime = 0.5f; if (Game1Parameters.ConfirmSound) { this.gameObject.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>(MagicOrchestraUtils.pathToSoundMessages + "wrong"); this.gameObject.GetComponent <AudioSource>().Play(); waitTime = this.gameObject.GetComponent <AudioSource>().clip.length; } yield return(new WaitForSeconds(waitTime)); MagicOrchestraUtils.SwitchOffLightFeedback(); }
public static void LogMe(bool isFirstPanel) { if (!isFirstPanel) { Debug.Log("Sequenza: " + MagicOrchestraUtils.StringifySequence(Sequence)); } Debug.Log("Difficulty: " + Difficulty); Debug.Log("TimeInShowing: " + TimeInShowing); Debug.Log("LightColor: " + LightColor); Debug.Log("IsGestureMode: " + IsGestureMode); Debug.Log("TimeInDetecting: " + TimeInDetecting); Debug.Log("ShowPlane: " + ShowPlane); Debug.Log("Zenith camera orthographic" + IsZenithOrthographic); Debug.Log("Suono di conferma:" + ConfirmSound); }
/// <summary> /// Coroutine of end game, after the completion of the task /// </summary> /// <returns></returns> IEnumerator FinalCoroutine() { InstruMapsCanvasController.singleton.DisableAllButtons(); float waitTime = MagicOrchestraUtils.generalTextTimeShow_long; panelMessage.SetActive(true); // Message frontalTextMessage.GetComponent <Text>().text = MagicOrchestraUtils.correctArenaDisposition; // Light feedback MagicOrchestraUtils.PositiveLightFeedback(); // First sound if (MagicOrchestraParameters.IsContext) { frontalTextMessage.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>(MagicOrchestraUtils.pathToSoundMessages + "sequence_correct_context"); } else { frontalTextMessage.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>(MagicOrchestraUtils.pathToSoundMessages + "sequence_correct"); } frontalTextMessage.GetComponent <AudioSource>().Play(); yield return(new WaitForSeconds(frontalTextMessage.GetComponent <AudioSource>().clip.length)); waitTime -= frontalTextMessage.GetComponent <AudioSource>().clip.length; // Second sound frontalTextMessage.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>(MagicOrchestraUtils.pathToTextMessages + "correctArenaDisposition"); frontalTextMessage.GetComponent <AudioSource>().Play(); yield return(new WaitForSeconds(frontalTextMessage.GetComponent <AudioSource>().clip.length)); waitTime -= frontalTextMessage.GetComponent <AudioSource>().clip.length; yield return(new WaitForSeconds(waitTime)); panelMessage.SetActive(false); frontalTextMessage.GetComponent <Text>().text = ""; yield return(new WaitForSeconds(MagicOrchestraUtils.generalPauseTime_short)); MagicOrchestraUtils.SwitchOffLightFeedback(); InstruMapsController.singleton.EndGame(); StopClassCoroutine(); }
public static string StringifyMe() { string toReturn = ""; toReturn += ("Sequenza: " + MagicOrchestraUtils.StringifySequence(Sequence) + "\n"); toReturn += ("Difficoltà: " + Difficulty + "\n"); toReturn += ("Modalità ordine inverso: " + MagicOrchestraUtils.TrueFalseConverter(IsReverse) + "\n"); toReturn += ("Tempo proiezione frontale: " + TimeInShowing + MagicOrchestraUtils.SecondsTextItalianSuffix(TimeInShowing) + "\n"); if (MagicOrchestraParameters.IsContext) { toReturn += ("Modalità aiuto: " + MagicOrchestraUtils.TrueFalseConverter(isHintMode) + "\n"); if (IsHintMode) { toReturn += ("Modalità carte randomiche: " + MagicOrchestraUtils.TrueFalseConverter(isShuffle) + "\n"); } } toReturn += ("Suono di conferma: " + MagicOrchestraUtils.TrueFalseConverter(ConfirmSound) + "\n"); return(toReturn); }
/* <summary> * Update is called once per frame * </summary> */ void Update() { // Parsing value float value = gameObject.GetComponent <Slider>().value; value *= (highTime - lowTime); value += lowTime; float newValue = MagicOrchestraUtils.FiveMathRounder(value); // Texting value string toVisualize = newValue.ToString() + MagicOrchestraUtils.SecondsTextItalianSuffix(newValue); gameObject.transform.GetChild(gameObject.transform.childCount - 1).gameObject.GetComponent <Text>().text = toVisualize; // Saving value this.currentTime = newValue; // Correcting the slider newValue -= lowTime; newValue /= (highTime - lowTime); gameObject.GetComponent <Slider>().value = newValue; }
// Update is called once for frame void Update() { if (this.isRaycasterEnabled) { // Looking to the nearest skelpos KinectBodySkeleton skel = MagicOrchestraUtils.GetNearestSkeleton(); if (skel == null) { Debug.Log("No MagicRoomKinectV2Manager founded"); return; } // Computing new Vector3 position this.tr.position = new Vector3(multX * skel.HandLeft.x * _AdapterRoomSize.x + shiftX, gameObject.transform.position.y, multZ * skel.HandLeft.y + shiftZ); // Moving cursor on the game gameObject.transform.position = tr.position; // Select the object to drag if (skel.isLeftHandClosed()) { gameObject.GetComponent <SpriteRenderer>().sprite = spritesHands[1]; if (!this.isDrag) { RaycastHit hitInfo; this.target = GetHitTargetObject(out hitInfo); //this.oldScale = this.target.transform.localScale; if (Game1Parameters.ConfirmSound) { this.transform.parent.gameObject.transform.parent.gameObject.GetComponent <AudioSource>().Play(); } } if (this.target != null) { this.isDrag = true; this.CallTargetScript(); this.target.transform.position = new Vector3(this.target.transform.position.x, 1.5f, this.target.transform.position.z); //this.target.transform.localScale = this.dragScale; } } if (!skel.isLeftHandClosed()) { gameObject.GetComponent <SpriteRenderer>().sprite = spritesHands[0]; this.isDrag = false; if (this.target != null) { this.target.transform.position = new Vector3(this.target.transform.position.x, 0, this.target.transform.position.z); //this.target.transform.localScale = this.oldScale; } } // Dragging the object if (this.isDrag) { if (this.target == null) { Debug.Log("Something strange"); } else { this.target.transform.position = new Vector3(tr.position.x, this.target.transform.position.y, tr.position.z); } } // Moving cursor on the game // gameObject.transform.position = tr.position; } }
private IEnumerator LightCoroutine(GameObject cubeToLight, bool isFinal, bool isSequenceCorrect) { //Turn on the light CorsiUtils.ShowLightOnCube(cubeToLight, lightMaterial); yield return(new WaitForSeconds(CorsiUtils.reactionLightTime)); //Turn off the light CorsiUtils.RestoreIntialCube(cubeToLight, defaultMaterial); //Final cube detected if (isFinal) { float waitTime = MagicOrchestraUtils.generalTextTimeShow_long; //Recalling game manager if (isSequenceCorrect) { panelMessage.SetActive(true); // Message frontalTextMessage.GetComponent <Text>().text = MagicOrchestraUtils.correctSequenceMessage; // Light feedback MagicOrchestraUtils.PositiveLightFeedback(); // First sound if (MagicOrchestraParameters.IsContext) { frontalTextMessage.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>(MagicOrchestraUtils.pathToSoundMessages + "sequence_correct_context"); } else { frontalTextMessage.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>(MagicOrchestraUtils.pathToSoundMessages + "sequence_correct"); } frontalTextMessage.GetComponent <AudioSource>().Play(); waitTime -= frontalTextMessage.GetComponent <AudioSource>().clip.length; yield return(new WaitForSeconds(frontalTextMessage.GetComponent <AudioSource>().clip.length)); // Second sound frontalTextMessage.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>(MagicOrchestraUtils.pathToTextMessages + "correctSequenceMessage"); frontalTextMessage.GetComponent <AudioSource>().Play(); waitTime -= frontalTextMessage.GetComponent <AudioSource>().clip.length; yield return(new WaitForSeconds(frontalTextMessage.GetComponent <AudioSource>().clip.length)); yield return(new WaitForSeconds(waitTime)); panelMessage.SetActive(false); frontalTextMessage.GetComponent <Text>().text = ""; yield return(new WaitForSeconds(MagicOrchestraUtils.generalPauseTime_short)); MagicOrchestraUtils.SwitchOffLightFeedback(); CorsiController.singleton.CorrectUserSequence(); } else { panelMessage.SetActive(true); // Message frontalTextMessage.GetComponent <Text>().text = MagicOrchestraUtils.wrongSequenceMessage; // Light feedback MagicOrchestraUtils.NegativeLightFeedback(); // First sound frontalTextMessage.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>(MagicOrchestraUtils.pathToSoundMessages + "sequence_wrong"); frontalTextMessage.GetComponent <AudioSource>().Play(); waitTime -= frontalTextMessage.GetComponent <AudioSource>().clip.length; yield return(new WaitForSeconds(frontalTextMessage.GetComponent <AudioSource>().clip.length)); // Second sound frontalTextMessage.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>(MagicOrchestraUtils.pathToTextMessages + "wrongSequenceMessage"); frontalTextMessage.GetComponent <AudioSource>().Play(); waitTime -= frontalTextMessage.GetComponent <AudioSource>().clip.length; yield return(new WaitForSeconds(frontalTextMessage.GetComponent <AudioSource>().clip.length)); yield return(new WaitForSeconds(waitTime)); panelMessage.SetActive(false); frontalTextMessage.GetComponent <Text>().text = ""; yield return(new WaitForSeconds(MagicOrchestraUtils.generalPauseTime_short)); MagicOrchestraUtils.SwitchOffLightFeedback(); CorsiController.singleton.WrongUserSequence(); } } //Abort coroutine StopClassCoroutine(); }
private IEnumerator FinalCoroutine(bool hasWin) { panelMessage.SetActive(true); float waitTime = MagicOrchestraUtils.generalTextTimeShow_long; //Showing user turn information if (hasWin) { // Message frontalTextMessage.GetComponent <Text>().text = MagicOrchestraUtils.correctSequenceMessage; // Light feedback MagicOrchestraUtils.PositiveLightFeedback(); // First sound if (MagicOrchestraParameters.IsContext) { frontalTextMessage.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>(MagicOrchestraUtils.pathToSoundMessages + "sequence_correct_context"); } else { frontalTextMessage.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>(MagicOrchestraUtils.pathToSoundMessages + "sequence_correct"); } frontalTextMessage.GetComponent <AudioSource>().Play(); waitTime -= frontalTextMessage.GetComponent <AudioSource>().clip.length; yield return(new WaitForSeconds(frontalTextMessage.GetComponent <AudioSource>().clip.length)); // Second sound frontalTextMessage.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>(MagicOrchestraUtils.pathToTextMessages + "correctSequenceMessage"); frontalTextMessage.GetComponent <AudioSource>().Play(); waitTime -= frontalTextMessage.GetComponent <AudioSource>().clip.length; yield return(new WaitForSeconds(frontalTextMessage.GetComponent <AudioSource>().clip.length)); } else { // Message frontalTextMessage.GetComponent <Text>().text = MagicOrchestraUtils.wrongSequenceMessage; // Light feedback MagicOrchestraUtils.NegativeLightFeedback(); // First sound frontalTextMessage.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>(MagicOrchestraUtils.pathToSoundMessages + "sequence_wrong"); frontalTextMessage.GetComponent <AudioSource>().Play(); waitTime -= frontalTextMessage.GetComponent <AudioSource>().clip.length; yield return(new WaitForSeconds(frontalTextMessage.GetComponent <AudioSource>().clip.length)); // Second sound frontalTextMessage.GetComponent <AudioSource>().clip = Resources.Load <AudioClip>(MagicOrchestraUtils.pathToTextMessages + "wrongSequenceMessage"); frontalTextMessage.GetComponent <AudioSource>().Play(); waitTime -= frontalTextMessage.GetComponent <AudioSource>().clip.length; yield return(new WaitForSeconds(frontalTextMessage.GetComponent <AudioSource>().clip.length)); } yield return(new WaitForSeconds(waitTime)); panelMessage.SetActive(false); frontalTextMessage.GetComponent <Text>().text = ""; yield return(new WaitForSeconds(MagicOrchestraUtils.generalPauseTime_short)); MagicOrchestraUtils.SwitchOffLightFeedback(); //Recalling correct function if (hasWin) { Game2Controller.singleton.CorrectUserSequence(); } else { Game2Controller.singleton.WrongUserSequence(); } //this.StopClassCoroutine(); }