Esempio n. 1
0
    private void ResetNorthMagnets()
    {
        // Find all placed north magnets in the map
        northMagnetsPlaced = GameObject.FindGameObjectsWithTag("NorthMagnet");
        // If there are magnets that have been placed
        // Cycle through northMagnetsPlaced array and set their velocities to 0
        // Set gameobjects to false
        if (northMagnetsPlaced.Length > 0)
        {
            foreach (GameObject northMagnet in northMagnetsPlaced)
            {
                northMagnet.GetComponent <Rigidbody>().velocity = Vector3.zero;
                northMagnet.SetActive(false);
            }
        }
        else
        {
            debugText.text = "No north magnets in the puzzle";
        }

        // Reset ballsPlaced variable in BetaMagnetPlacement class
        betaManager.Reset();
        // Attach magnet to oculus go remote
        betaManager.MagnetAttach();
    }
Esempio n. 2
0
 // Method for going to the next puzzle or complete the level
 // Sets MaxPlaceableMagnets in the beta level manager to the MaxMagnets of the next puzzle
 private void NextLevelOrPuzzle()
 {
     // If the next calculated puzzle return as null go to the next level
     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();
         // Find and disable magnet counter
         GameObject.Find("Magnet Counter Canvas").SetActive(false);
     }
     else
     {
         // Play photon shoot sound
         AudioManager.Instance.Play("PhotonShoot");
         // Go to the next puzzle if there is one
         GameManager.Instance.NextPuzzle();
         betaSetMaxMagnets = GameObject.Find(GameManager.Instance.FindActivePuzzle().name).GetComponent <BetaSetMaxMagnets>();
         // Set the max placeable magnets for the next puzzle
         betaLevelManager.MaxPlaceableMagnets = betaSetMaxMagnets.maxMagnets;
         // Reset the puzzle
         betaLevelManager.Reset();
         // Attach a new magnet
         betaLevelManager.MagnetAttach();
     }
 }