public void SetAnimation <T>(LightAnimation animation, byte animationSpeed, T animationParameter) where T : Enum => SetAnimation( animation, animationSpeed, animationParameter, Color.Black );
/// <summary> /// Starts the game. Should be called after the player sits in a chair /// </summary> public void StartGame() { //Debug.Log("game proc start"); isPaused = false; if (currentQuestionNumber == 0) { UIManager.instance.ResetMoneyTreePanel(); gameFormat = new ClassicGameFormat(); difficlutyLevel = 1; //currentQuestionNumber = 0; musicAudioSource.Stop(); musicAudioSource.PlayOneShot(classicModeAudio[11]); StartCoroutine(LetsPlayLD()); LightAnimation.SmallCircleUp(); } //else //{ // UIManager.uim.LoadGameUI(); // ContinueGameProcess(); //} UIManager.instance.confetti.SetActive(false); }
public void SetAnimation <T>(LightAnimation animation, byte animationSpeed, T animationParameter, Color color) where T : Enum => SetAnimation( animation, animationSpeed, (byte)Convert.ChangeType(animationParameter, TypeCode.Byte), color );
// Use this for initialization void Start() { levelManager = FindObjectOfType <LevelManager> (); playerGovernor = FindObjectOfType <PlayerGovernor> (); //gameObject.GetComponent<MeshRenderer> ().material.color = inactiveCheckPoint; lightAnim = GetComponentInChildren <LightAnimation>(); theLight = GetComponentInChildren <Light>(); }
public void SetAnimation(LightAnimation animation, byte animationSpeed, byte animationParameter, Color color) { InAppearanceConfigurationMode(() => Send( 0x02, 0xF3, 0x49, 0x04, 0x06, 0x00, 0x00, 0x00, color.R, color.G, color.B, (byte)animation, (byte)(15 - ClampSpeedValue(animationSpeed)), animationParameter )); }
// Use this for initialization void Start() { levelManager = FindObjectOfType<LevelManager> (); playerGovernor = FindObjectOfType<PlayerGovernor> (); //gameObject.GetComponent<MeshRenderer> ().material.color = inactiveCheckPoint; lightAnim = GetComponentInChildren<LightAnimation>(); theLight = GetComponentInChildren<Light>(); }
/// <summary> /// Starts the game. Should be called after the player sits in a chair /// </summary> public void StartGame() { UIManager.uim.gameObject.GetComponent <AudioSource>().enabled = false; gameFormat = new ClassicGameFormat(); difficlutyLevel = 1; currentQuestionNumber = 0; audioSource.PlayOneShot(classicModeAudio[11]); StartCoroutine(LetsPlayLD()); LightAnimation.SmallCircleUp(); }
/// <summary> /// Dispays current prize /// </summary> /// <param name="profit">money that player get</param> /// <returns></returns> public IEnumerator ShowCurrentPrizePanel(string profit, bool isGameOver) { currentPrizePanel.transform.GetChild(2).GetComponent <Text>().text = profit; // if we win million if (GameProcess.instance.state == State.MILLION_WON) { millionWinPanel.SetActive(true); LightAnimation.TurnOnBigCircle(); confetti.SetActive(true); yield return(new WaitForSeconds(4f)); millionWinPanel.SetActive(false); GameProcess.instance.state = State.GAME_IS_NOT_STARTED; GameProcess.instance.currentQuestionNumber = 0; PlayerControll.instance.StandUp(); } // if game over else if (isGameOver) { LightAnimation.TurnOnBigCircle(); currentPrizePanel.transform.GetChild(3).gameObject.SetActive(true); currentPrizePanel.transform.GetChild(0).gameObject.SetActive(true); currentPrizePanel.transform.GetChild(1).gameObject.GetComponent <Image>().sprite = totalPrizeSprite; currentPrizePanel.SetActive(true); yield return(new WaitForSeconds(4f)); currentPrizePanel.transform.GetChild(3).gameObject.SetActive(false); currentPrizePanel.transform.GetChild(0).gameObject.SetActive(false); currentPrizePanel.transform.GetChild(1).gameObject.GetComponent <Image>().sprite = currentPrizeSprite; currentPrizePanel.SetActive(false); PlayerControll.instance.StandUp(); } // if it's just correct answer else { currentPrizePanel.SetActive(true); yield return(new WaitForSeconds(4f)); currentPrizePanel.SetActive(false); StartCoroutine(ShowMoneyTreePanel()); } }
public IEnumerator PlayCorrectThenLDSound() { //if it's question 6-15, correct answer sound's index is calculating automatically (5*i-10) | LD index is calculating automatically (5*i-9) audioSource.Stop(); audioSource.PlayOneShot(classicModeAudio[5 * currentQuestionNumber - 10]); Debug.Log("Sound: " + classicModeAudio[5 * currentQuestionNumber - 10].name); yield return(new WaitForSeconds(5f)); audioSource.Stop(); LightAnimation.SmallCircleDown(); audioSource.PlayOneShot(classicModeAudio[5 * currentQuestionNumber - 9]); Debug.Log("Sound: " + classicModeAudio[5 * currentQuestionNumber - 9].name); yield return(new WaitForSeconds(4f)); LoadQuestion(); }
void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { if (Application.loadedLevel == 0) { Back(); } else { pausePanel.SetActive(!pausePanel.activeSelf); } } if (Input.GetKeyDown(KeyCode.M) && GameProcess.gp.state != State.GAME_IS_NOT_STARTED) { //opening/closing Money Tree Panel if (moneyTreePanel.activeSelf) { StartCoroutine(CloseMoneyTreePanel()); } else { StartCoroutine(ShowMoneyTreePanel()); } } else if (Input.GetKeyDown(KeyCode.Keypad1)) { LightAnimation.SmallCircleUp(); } else if (Input.GetKeyDown(KeyCode.Keypad2)) { LightAnimation.SmallCircleDown(); } else if (Input.GetKeyDown(KeyCode.Keypad3)) { LightAnimation.BigCircleUp(); } else if (Input.GetKeyDown(KeyCode.Keypad4)) { LightAnimation.BigCircleDown(); } }
public IEnumerator PlayCorrectThenLDSound() { //if it's question 6-15, correct answer sound's index is calculating automatically (5*i-10) | LD index is calculating automatically (5*i-9) musicAudioSource.Stop(); musicAudioSource.PlayOneShot(classicModeAudio[5 * currentQuestionNumber - 10]); Debug.Log("Sound: " + classicModeAudio[5 * currentQuestionNumber - 10].name + "length " + classicModeAudio[5 * currentQuestionNumber - 10].length); yield return(new WaitForSeconds(classicModeAudio[5 * currentQuestionNumber - 10].length + 0.2f)); musicAudioSource.Stop(); LightAnimation.SmallCircleDown(); musicAudioSource.PlayOneShot(classicModeAudio[5 * currentQuestionNumber - 9]); Debug.Log("Sound: " + classicModeAudio[5 * currentQuestionNumber - 9].name + "length " + classicModeAudio[5 * currentQuestionNumber - 9].length); yield return(new WaitForSeconds(4f)); //classicModeAudio[5 * currentQuestionNumber - 9].length); if (GameProcess.isPaused) { continuePoint = LoadQuestion; } else { LoadQuestion(); } }
public void LoadLightAnim(LightAnimation lightAnim) { }
public void PlaySound() { //if its first 5 questions if (currentQuestionNumber < 5) { if (state == State.WAITING_ANSWER) { //LightAnimation.SmallCircleDown(); //LightAnimation.BigCircleDown(); if (currentQuestionNumber == 1) { musicAudioSource.PlayOneShot(classicModeAudio[12]); DOVirtual.DelayedCall(classicModeAudio[12].length + 0.2f, CheckIfMusicIsPlaying); } } else if (state == State.WRONG_ANSWER) { musicAudioSource.Stop(); musicAudioSource.PlayOneShot(classicModeAudio[13]); } else if (state == State.CORRECT_ANSWER) { //LightAnimation.SmallCircleUp(); //LightAnimation.BigCircleUp(); soundsAudioSource.PlayOneShot(classicModeAudio[14]); } } //if it's 5-15 question else { if (state == State.WAITING_ANSWER) { //if it's question 5-15 question sound index (5*i-13) if (currentQuestionNumber != 5) { musicAudioSource.Stop(); LightAnimation.SmallCircleUp(); //LightAnimation.BigCircleUp(); LightAnimation.TurnOffBigCircle(); musicAudioSource.PlayOneShot(classicModeAudio[5 * currentQuestionNumber - 13]); //Debug.Log("Sound: " + classicModeAudio[5 * currentQuestionNumber - 13].name); } } else if (state == State.FINAL_ANSWER_GIVEN) { if (currentQuestionNumber != 5) { musicAudioSource.Stop(); musicAudioSource.PlayOneShot(classicModeAudio[5 * currentQuestionNumber - 12]); //Debug.Log("Sound: " + classicModeAudio[5 * currentQuestionNumber - 12].name); } } else if (state == State.WRONG_ANSWER) { musicAudioSource.Stop(); musicAudioSource.PlayOneShot(classicModeAudio[5 * currentQuestionNumber - 11]); //Debug.Log("Sound: " + classicModeAudio[5 * currentQuestionNumber - 11].name); } else if (state == State.CORRECT_ANSWER) { soundsAudioSource.Stop(); StartCoroutine(PlayCorrectThenLDSound()); } else if (state == State.MILLION_WON) { musicAudioSource.Stop(); musicAudioSource.PlayOneShot(classicModeAudio[65]); DOVirtual.DelayedCall(classicModeAudio[65].length + 4f, delegate { if (!musicAudioSource.isPlaying && state == State.GAME_IS_NOT_STARTED) { PlayMainTheme(); } }); } } }
/// <summary> /// Creates audience answers /// </summary> /// <returns>Returns array of 4 int values (at [0] is persents ofanswer A , [1] - B, etc)</returns> public int[] Use() { LightAnimation.TurnOnBigCircle(); int[] results = new int[4]; int idOfRightAnswer = GameProcess.instance.question.CorrectAnswer; // (1 to 4) /////////////////////////////////////////////////////////////////////////////////////////////////// //if lifeline 5050 was used for this question //we have 2 avaliable answers /////////////////////////////////////////////////////////////////////////////////////////////////// if (GameProcess.instance.isLifeline5050JustUsed) { int idOfWrongAnswer = 1; // (1 to 4) //finding id of wrong answer for (int i = 0; i < 4; i++) { if (GameProcess.instance.isAnswerAvailable[i] == true && idOfRightAnswer != i + 1) { idOfWrongAnswer = i + 1; } //all other answers persents is set to 0 else { results[i] = 0; } } //if audience should give wrong answer if (Random.Range(1, 101) > probabilityOfCorrectAnswer) //probability of this is 100 - probabilityOfCorrectAnswer % { //assigning wrong persents then rigth results[idOfWrongAnswer - 1] = Random.Range(51, 101); results[idOfRightAnswer - 1] = 100 - results[idOfWrongAnswer - 1]; } //if audience should give right answer else { //assigning rigth persents then wrong results[idOfRightAnswer - 1] = Random.Range(51, 101); results[idOfWrongAnswer - 1] = 100 - results[idOfRightAnswer - 1]; } return(results); } /////////////////////////////////////////////////////////////////////////////////////////////////// //if lifeline 5050 was NOT used for this question //we have 4 avaliable answers /////////////////////////////////////////////////////////////////////////////////////////////////// else { //if audience should give wrong answer if (Random.Range(1, 101) > probabilityOfCorrectAnswer) //probability of this is 100 - probabilityOfCorrectAnswer % { int newIndex; do { newIndex = Random.Range(1, 5); }while (newIndex == results[idOfRightAnswer - 1]); } //creating correct answer persentage results[idOfRightAnswer - 1] = Random.Range(40, 90); int notUsedPersents = 100 - results[idOfRightAnswer - 1]; int indexOfQuestion = 1; //creating other persentages while (indexOfQuestion < 5) { //if it's not correct answer if (indexOfQuestion != idOfRightAnswer) { //if it's last question, is's persents will be all pers. that was not used if (indexOfQuestion == 4) { results[indexOfQuestion - 1] = notUsedPersents; } else { //taking random value from notUsedPersents but smaller than persents of correct answer //if not used pers. biger than pers. of correct answer if (notUsedPersents > results[idOfRightAnswer - 1]) { results[indexOfQuestion - 1] = Random.Range(0, results[idOfRightAnswer - 1] - 1); notUsedPersents -= results[indexOfQuestion - 1]; } else { results[indexOfQuestion - 1] = Random.Range(0, notUsedPersents); notUsedPersents -= results[indexOfQuestion - 1]; } } } indexOfQuestion++; } return(results); } }
public void SetAnimation(LightAnimation animation, byte animationSpeed) => SetAnimation(animation, animationSpeed, (byte)0, Color.Black);
public void PlaySound() { //if its first 5 questions if (currentQuestionNumber < 5) { if (state == State.WAITING_ANSWER) { LightAnimation.SmallCircleDown(); LightAnimation.BigCircleDown(); if (currentQuestionNumber == 1) { audioSource.PlayOneShot(classicModeAudio[12]); } } else if (state == State.WRONG_ANSWER) { audioSource.PlayOneShot(classicModeAudio[13]); } else if (state == State.CORRECT_ANSWER) { LightAnimation.SmallCircleUp(); LightAnimation.BigCircleUp(); audioSource.PlayOneShot(classicModeAudio[14]); } } //if it's 5-15 question else { if (state == State.WAITING_ANSWER) { //if it's question 5-15 question sound index (5*i-13) if (currentQuestionNumber != 5) { audioSource.Stop(); LightAnimation.SmallCircleUp(); LightAnimation.BigCircleUp(); audioSource.PlayOneShot(classicModeAudio[5 * currentQuestionNumber - 13]); Debug.Log("Sound: " + classicModeAudio[5 * currentQuestionNumber - 13].name); } } else if (state == State.FINAL_ANSWER_GIVEN) { if (currentQuestionNumber != 5) { audioSource.Stop(); audioSource.PlayOneShot(classicModeAudio[5 * currentQuestionNumber - 12]); Debug.Log("Sound: " + classicModeAudio[5 * currentQuestionNumber - 12].name); } } else if (state == State.WRONG_ANSWER) { audioSource.Stop(); audioSource.PlayOneShot(classicModeAudio[5 * currentQuestionNumber - 11]); Debug.Log("Sound: " + classicModeAudio[5 * currentQuestionNumber - 11].name); } else if (state == State.CORRECT_ANSWER) { audioSource.Stop(); StartCoroutine(PlayCorrectThenLDSound()); } } }