コード例 #1
0
    void Start()
    {
        gameManagerScr = GameObject.Find("_GameManager").GetComponent <S_GameManager>();
        //sets the text on the start of game UI pop-up if necessary
        switch (SceneManager.GetActiveScene().buildIndex)
        {
        case 0: break;

        case 1: break;

        case 2: descriptionText.text = ""; break;

        case 3: descriptionText.text = ""; break;

        case 4: descriptionText.text = ""; break;

        case 5: descriptionText.text = "Watch out for moving objects!"; break;

        case 6: descriptionText.text = ""; break;

        case 7: descriptionText.text = ""; break;

        case 8: descriptionText.text = ""; break;

        default: break;
        }
        mySound         = GetComponent <AudioSource>();
        musicController = GameObject.FindGameObjectWithTag("MusicController").GetComponent <AudioSource>();

        //set the sliders in the settings menu to represent current settings
        volumeSlider.value    = gameManagerScr.volume;
        SFXVolumeSlider.value = gameManagerScr.SFXVolume;
    }
コード例 #2
0
    [SerializeField] ParticleSystem confettiSystem; //used for end of level celebration

    void Awake()
    {
        //singleton checks
        if (control == null)
        {
            DontDestroyOnLoad(gameObject);
            control = this;
        }
        else if (control != this)
        {
            Destroy(gameObject);
        }
        //continuous music
        if (!mySound)
        {
            mySound = GetComponent <AudioSource>();
        }
        //check to perform code on every scene loading except the menu
        if (SceneManager.GetActiveScene().buildIndex != menu)
        {
            //initialise UI elements
            coinsScoreText    = GameObject.Find("Coins Score Text").GetComponent <Text>();
            shieldCountText   = GameObject.Find("Shield Score Text").GetComponent <Text>();
            timeWarpCountText = GameObject.Find("Bomb Score Text").GetComponent <Text>();
            //find a reference to the player and mirror shields
            playerShield = GameObject.FindGameObjectWithTag("PlayerShield");
            mirrorShield = GameObject.FindGameObjectWithTag("MirrorShield");
        }
        else
        {
            //used to track how many coins are collected in this session. Was used for Google Play achievement tracking...
            coinStart = coins;
        }
    }
コード例 #3
0
 // Use this for initialization
 void Start()
 {
     //find and get references to end cube and gamemanager
     endCube        = GameObject.Find("End Cube");
     gameManagerScr = GameObject.Find("_GameManager").GetComponent <S_GameManager>();
     gameManagerScr.UpdateScores();                             //update UI on game start
     playerMat = gameObject.GetComponent <Renderer>().material; //get the material of the player object (mirror or player)
 }
コード例 #4
0
 private void Start()
 {
     playerMovementScr = GameObject.Find("Player").GetComponent <S_PlayerMovement>();
     gameManagerScr    = GameObject.Find("_GameManager").GetComponent <S_GameManager>();
     moneyButtons.gameObject.SetActive(false);
     mySound = GetComponent <AudioSource>();
     popUpAnim.SetTrigger("Use");                        //trigger pop up UI to slide in from bottom
     InvokeRepeating("PlayButtonAnimation", 2.0f, 4.0f); //start the animation loop for the playbutton animations
 }
コード例 #5
0
 void Awake()
 {
     if (gameManager == null)
     {
         //DontDestroyOnLoad(gameObject); // Dont destroy this
         gameManager = this;
     }
     else if (gameManager != this)
     {
         Destroy(gameObject); // Destroy this as another exists
     }
 }
コード例 #6
0
    void Start()
    {
        //create references to required objects
        playerRigidbody = GetComponent <Rigidbody>();
        mainCamera      = FindObjectOfType <Camera>();
        player          = gameObject;
        playerCollScr   = player.GetComponent <S_PlayerCollisions>();
        mirror          = GameObject.Find("Mirror");
        mirrorCollScr   = mirror.GetComponent <S_PlayerCollisions>();
        mirrorRigidbody = mirror.GetComponent <Rigidbody>();

        startTilt = Input.acceleration; //this is used to centre the movement based on the position the user started in rather than true flat

        gameManagerScr = GameObject.Find("_GameManager").GetComponent <S_GameManager>();
        gameManagerScr.bGameInProgress = false; //set game to not in progress as the pop up menu will be onscreen

        timeImage = GameObject.FindGameObjectWithTag("TimeImage");
        timeAnim  = timeImage.GetComponent <Animator>();
        timeImage.SetActive(false);
    }
コード例 #7
0
    void Start()
    {
        gameManagerScr = GameObject.Find("_GameManager").GetComponent <S_GameManager>();
        moneyButtons.gameObject.SetActive(false);
        mySound = GetComponent <AudioSource>();
        InvokeRepeating("PlayButtonAnimation", 2.0f, 4.0f); //start the animation loop for the playbutton animations
        bAnimationFinished = false;                         //bool used to track when animations are finished
        Time.timeScale     = 1.0f;                          //ensure timescale is at 1 if player returned to menu during timewarp mode

        /////////////////////// Google Play Services Stuff ////////////////////////////////////////////////

        /*PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
         * PlayGamesPlatform.InitializeInstance(config);
         * // recommended for debugging:
         * PlayGamesPlatform.DebugLogEnabled = true;
         * // Activate the Google Play Games platform
         * PlayGamesPlatform.Activate();
         * //SignIn();
         *
         */
    }
コード例 #8
0
    void Start()
    {
        gameManagerScr = GameObject.Find("_GameManager").GetComponent <S_GameManager>();
        tutorialCount  = gameManagerScr.tutorialCount; //this value stores what stage of the tutorial the player is currently on
        coin1.SetActive(false);
        coin2.SetActive(false);
        //set up the tutorial level based on the current tutorial stage
        switch (tutorialCount)
        {
        case 0:
            //first step of tut: movement
            tutorialText.text = "Tilt to move";
            break;

        case 1:
            //second step of tut: obstacles
            Instantiate(firstBarrier);
            tutorialText.text = "RED MEANS DANGER!";
            break;

        case 2:
            //third step of tut: coins
            Instantiate(firstBarrier);
            coin1.SetActive(true);
            coin2.SetActive(true);
            tutorialText.text = "Coins are your friend!";
            break;

        case 3:
            //fourth step of tut: shop and shield
            coin1.SetActive(true);
            coin2.SetActive(true);
            Instantiate(shieldBarrier);
            tutorialText.text = "Who doesn't love shopping?!";
            break;
        }
    }
コード例 #9
0
 // Use this for initialization
 void Start()
 {
     gameManagerScr = GameObject.FindGameObjectWithTag("GameManager").GetComponent <S_GameManager>();
     mySound        = GetComponent <AudioSource>();
 }
コード例 #10
0
ファイル: S_GameManager.cs プロジェクト: Yamih/E-art-Sudoku
 // Use this for initialization
 void Start()
 {
     Instance = this;
 }