Example #1
0
    void Awake()
    {
        GameObject m = GameObject.Find("MAIN");

        main  = m.GetComponent <SCR_main>();
        music = m.GetComponent <SCR_music>();

        if (stageMusic && SCR_main.hMusic)
        {
            music.PlayMusic(stageMusic);
        }

        SCR_input.playerControlActive = false;

        pauseAllowed      = false;
        paused            = false;
        SCR_main.scoreRec = SCR_main.score;
        scoreRec          = SCR_main.score;

        GameObject camInst = Instantiate(stageCamera, Vector3.zero, Quaternion.identity) as GameObject;

        GameObject spawnPointPlayer = GameObject.Find("SpawnPointPlayer");
        Vector3    playerPos        = new Vector3(spawnPointPlayer.transform.position.x, 0f, spawnPointPlayer.transform.position.z);

        if (main.playerSelect == true)
        {
            GameObject playerInst = Instantiate(main.playerObj1, playerPos, Quaternion.identity) as GameObject;
            Destroy(spawnPointPlayer);
            player = playerInst.GetComponent <SCR_character>();

            SetupStageSize();

            cam = camInst.GetComponent <SCR_camStage>();
            cam.SetTarget(playerInst.transform);
            cam.InitiateStage(0);
        }
        else if (main.playerSelect == false)
        {
            GameObject playerInst = Instantiate(main.playerObj2, playerPos, Quaternion.identity) as GameObject;
            Destroy(spawnPointPlayer);
            player = playerInst.GetComponent <SCR_character>();

            SetupStageSize();

            cam = camInst.GetComponent <SCR_camStage>();
            cam.SetTarget(playerInst.transform);
            cam.InitiateStage(0);
        }


        if (skyBoxMaterial)
        {
            RenderSettings.skybox = skyBoxMaterial;
        }

        if (SCR_main.hCursor)
        {
            Cursor.visible = false;
        }

        SetState(10);

        SCR_gui.CreateScreenCover(0);
    }
Example #2
0
    void Awake()
    {
        GameObject m=GameObject.Find ("MAIN");
        main=m.GetComponent<SCR_main>();
        music=m.GetComponent<SCR_music>();

        if(stageMusic&&SCR_main.hMusic){
            music.PlayMusic(stageMusic);
        }

        SCR_input.playerControlActive=false;

        pauseAllowed=false;
        paused=false;
        SCR_main.scoreRec=SCR_main.score;
        scoreRec=SCR_main.score;

        GameObject camInst=Instantiate(stageCamera,Vector3.zero,Quaternion.identity) as GameObject;

        GameObject spawnPointPlayer=GameObject.Find ("SpawnPointPlayer");
        Vector3 playerPos=new Vector3(spawnPointPlayer.transform.position.x,0f,spawnPointPlayer.transform.position.z);

        if(main.playerSelect==true){
            GameObject playerInst=Instantiate(main.playerObj1,playerPos,Quaternion.identity) as GameObject;
            Destroy(spawnPointPlayer);
            player=playerInst.GetComponent<SCR_character>();

            SetupStageSize();

            cam=camInst.GetComponent<SCR_camStage>();
            cam.SetTarget(playerInst.transform);
            cam.InitiateStage(0);
         	}
        else if(main.playerSelect==false){
            GameObject playerInst=Instantiate(main.playerObj2,playerPos,Quaternion.identity) as GameObject;
            Destroy(spawnPointPlayer);
            player=playerInst.GetComponent<SCR_character>();

            SetupStageSize();

            cam=camInst.GetComponent<SCR_camStage>();
            cam.SetTarget(playerInst.transform);
            cam.InitiateStage(0);
        }

        if(skyBoxMaterial){
            RenderSettings.skybox=skyBoxMaterial;
        }

        if(SCR_main.hCursor){
            Cursor.visible=false;
        }

        SetState (10);

        SCR_gui.CreateScreenCover(0);
    }