Example #1
0
    private IEnumerator Attach()
    {
        // Wait x seconds before attaching a new photon
        yield return(new WaitForSeconds(1f));

        // Play photon attach particle effect
        _deltaManager.PhotonAttach();
    }
Example #2
0
    private void ResetPuzzle()
    {
        // Play puzzle failed sound
        AudioManager.Instance.Play("PuzzleFail");

        // Destroy all photons in the puzzle, if there are any
        GameObject[] photonsInPuzzle = GameObject.FindGameObjectsWithTag("Photon");
        if (photonsInPuzzle.Length > 0)
        {
            foreach (GameObject photon in photonsInPuzzle)
            {
                // Play particle effect in central photon particle effect script
                Destroy(photon);
            }
        }
        // Reset number of photons shot
        _deltaManager.PhotonsShot = 0;
        // Reset nu,ber of photons in goal
        _deltaManager.PhotonsInGoal = 0;
        // Set is photon attached bool to false
        _deltaManager.IsPhotonAttached = false;
        // Attach a new photon
        _deltaManager.PhotonAttach();
        // Get all goals in the puzzle
        GameObject[] goals = GameObject.FindGameObjectsWithTag("DeltaGoal");
        // Reset the emission colour on all goal gameobjects and has photon hit goal booleans
        foreach (GameObject goal in goals)
        {
            // Resetting colour
            Color origColour = goal.GetComponent <DeltaGoal>().OriginalColour;
            goal.GetComponent <MeshRenderer>().material.SetColor("_EmissionColor", origColour);
            // Resetting has photon hit goal bool
            DeltaGoal deltaGoal = goal.GetComponent <DeltaGoal>();
            deltaGoal.HasPhotonHit = false;
        }
    }
Example #3
0
    private IEnumerator NextPuzzleDelay()
    {
        // Wait a few sonds before going to the next puzzle
        yield return(new WaitForSeconds(_nextPuzzleWaitTime));

        if (GameManager.Instance.FindNextPuzzle(GameManager.Instance.FindActivePuzzle()) == null)
        {
            // Play photon shoot sound
            AudioManager.Instance.Play("PhotonShoot");
            // Call level completed method in the game manager
            GameManager.Instance.LevelCompleted();
        }
        else
        {
            // Play photon shoot sound
            AudioManager.Instance.Play("PhotonShoot");
            // Set photons shot back to 0
            _deltaManager.PhotonsShot = 0;
            // Go to the next puzzle
            GameManager.Instance.NextPuzzle();
            // Attach a new photon
            _deltaManager.PhotonAttach();
        }
    }