// Event void OnPhaseChange(BridgePhase phase) { inputAllowed = false; switch (phase) { case BridgePhase.Start: break; case BridgePhase.Countdown: break; case BridgePhase.Building: inputAllowed = true; timerObject.StartTimer(); break; case BridgePhase.Falling: timerObject.StartTimer(); break; case BridgePhase.Crossing: timerObject.StopTimer(); break; case BridgePhase.Lose: gameStarted = false; GameOver(DataType.GameEnd.FailedLevel); break; case BridgePhase.Finish: gameStarted = false; StartCoroutine(GameOverSequence()); break; } }
public void OnGameStart() { hasGameStarted = true; IsInputAllowed = true; timerClock.StartTimer(); if (OnGameStartEvent != null) { OnGameStartEvent(); } }
public void ShowDistricts() { ResultRoundProps.gameObject.SetActive(false); Panel.gameObject.SetActive(false); DistrictTimer.gameObject.SetActive(true); DistrictTimer.StartTimer(DistrictTime, CheckNextRound); }
void PostCountdownSetup() { inputAllowed = true; gameStarted = true; monsterObject.ChangeEmotions(DataType.MonsterEmotions.Happy); timer.StartTimer(); OnGameStart(); }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.name == "Floor(Clone)") { DeactivateTrail(); touch = true; timer.StartTimer(); } }
public void EndRound() { ActiveRoundProps.gameObject.SetActive(false); ResultRoundProps.gameObject.SetActive(true); var playerPoints = NewsController.ShowResults(_player1NewsItem, _player2NewsItem); GameController.GivePoints(playerPoints); ResultTimer.StartTimer(ResultsTime, ShowDistricts); }
public void StartRound() { DistrictTimer.gameObject.SetActive(false); StartRoundButton.gameObject.SetActive(false); Panel.gameObject.SetActive(true); NewsController.GetNews(() => { ActiveRoundProps.gameObject.SetActive(true); RoundTimer.StartTimer(RoundTime, EndRound); }); }
// Update is called once per frame private void Update() { if (player.touch == true && Input.GetMouseButtonDown(0)) { if (onFloor == true) { timer.StartTimer(); NewBlock.AddBlock(); onFloor = false; player.touch = false; } player.Jump(); stackScore++; } }
/// <summary> /// A method that creates anaglyph from the left and right image. /// </summary> /// <param name="dllVersion"> The dll version selected by the user. </param> /// <param name="anaglyphVersion"> User selection of anaglyph version. </param> /// <param name="leftImageInformation"> An instance of the class that stores information about the left image. </param> /// <param name="rightImageInformation"> An instance of the class that stores information about the right image. </param> /// <param name="threadAmount"> Number of threads selected by the user. </param> public void CreateAnaglyph(DllVersion dllVersion, AnaglyphVersion anaglyphVersion, ImageInformation leftImageInformation, ImageInformation rightImageInformation, int threadAmount) { int amountOfPixels = leftImageInformation.imagePixelArray.Length / 4; // the number of pixels that will be modified pixelsForThread = amountOfPixels / threadAmount; // the number of pixels to modify per thread if (pixelsForThread * threadAmount != leftImageInformation.imagePixelArray.Length / 4) // condition checking if the same number of pixels can be processed in each thread (different number of pixels) { int delta = amountOfPixels - (pixelsForThread * threadAmount); // number of pixels remaining PrepareThreads(threadAmount - 1); // prepare tables for the number of threads selected by the user minus one int start = pixelsForThread * (threadAmount - 1); // start index for a thread that modifies the rest of the pixels this.coords.Add(start); // start index for the last thread this.coords.Add(leftImageInformation.imagePixelArray.Length / 4); // end index for the last thread } else // the same number of pixels in each thread { PrepareThreads(threadAmount); // prepare a table of coordinates } anaglyphFilters = new float[12]; // creating an array that stores an anaglyph filter switch (anaglyphVersion) // choosing the right anaglyph filter depending on the user's choice { case AnaglyphVersion.TRUE_ANAGLYPH: anaglyphFilters = AnaglyphOptions._true; break; case AnaglyphVersion.GRAY_ANAGLYPH: anaglyphFilters = AnaglyphOptions._gray; break; case AnaglyphVersion.COLOR_ANAGLYPH: anaglyphFilters = AnaglyphOptions._color; break; case AnaglyphVersion.HALF_COLOR_ANAGLYPH: anaglyphFilters = AnaglyphOptions._halfColor; break; case AnaglyphVersion.OPTIMIZED_ANAGLYPH: anaglyphFilters = AnaglyphOptions._optimized; break; } tmpLeftImagePixelArray = new float[leftImageInformation.imagePixelArray.Length]; // creating a temporary array storing the pixels of the left image for (int i = 0; i < tmpLeftImagePixelArray.Length; i++) // loop that copies the pixel values of the left image into a temporary table { tmpLeftImagePixelArray[i] = leftImageInformation.imagePixelArray[i]; // copy the pixel color value from the left image to a temporary table } switch (dllVersion) // choice of dll depending on the user's choice { case DllVersion.ASM_DLL: // assembler dll choice for (int i = 0; i < this.coords.Count; i += 2) // loop calling as many times as there are coordinates (start and end) for each thread { int[] imageCoords = { this.coords[i] * 4, this.coords[i + 1] * 4 }; // get start and start index for the current thread var th = new Thread(() => // thread creation { AnaglyphAlgorithmAsm(leftImageInformation.imagePixelArray, imageCoords, anaglyphFilters, rightImageInformation.imagePixelArray); }); this.threads.Add(th); // adding a newly created thread to the list of threads } break; case DllVersion.CPP_DLL: // C++ dll choice for (int i = 0; i < this.coords.Count; i += 2) // loop calling as many times as there are coordinates(start and end) for each thread { int[] imageCoords = { this.coords[i] * 4, this.coords[i + 1] * 4 }; // get start and start index for the current thread var th = new Thread(() => // thread creation { AnaglyphAlgorithm(leftImageInformation.imagePixelArray, imageCoords, anaglyphFilters, rightImageInformation.imagePixelArray); }); this.threads.Add(th); // adding a newly created thread to the list of threads } break; } TimerClock.StartTimer(); // counting the time it takes for threads to finish foreach (Thread th in threads) // start all threads { th.Start(); } foreach (Thread th in threads) // waiting for the end of each thread { th.Join(); } TimerClock.StopTimer(); // stop counting time threads.Clear(); // clear the list of threads coords.Clear(); // clearing the list of start and end indexes leftImageInformation.finishConversion(); // creating an image based on returned pixels for (int i = 0; i < tmpLeftImagePixelArray.Length; i++) // copying the pixel color values from the previously created table to the table storing the pixel values of the left image { leftImageInformation.imagePixelArray[i] = tmpLeftImagePixelArray[i]; } EventImageFinished(leftImageInformation.imageBitmap); // reporting an event about the end of anaglyph creation }