示例#1
0
        //create next boss
        public void createNextBoss()
        {
            this.bossCurrentLife++;


            GameObject bossObject = new GameObject();
            tBoss      boss       = bossObject.AddComponent <tBoss>();

            boss.init(this, bossCurrentLife);
            //Destroy (THEBOSS.gameObject);
            THEBOSS          = boss;
            playerOrderIndex = 0;
            foreach (tPlayer x in players)
            {
                Destroy(x.gameObject);
            }
            foreach (tPlayer x in shadowPlayers)
            {
                Destroy(x.gameObject);
            }
            foreach (tEnvVar x in envVariables)
            {
                Destroy(x.model.gameObject);
                Destroy(x.gameObject);
            }
            this.players.Clear();
            this.shadowPlayers.Clear();
            this.envVariables.Clear();
            players       = new List <tPlayer> ();
            shadowPlayers = new List <tPlayer> ();
            envVariables  = new List <tEnvVar> ();
            //createInitialEnv ();
            playerOrderIndex = 0;
            addPlayer(playerOrder[playerOrderIndex], 1, -4, -4);
            playerOrderIndex++;
            currentplayer = players [0];
            if (currentplayer.playerType == 0)
            {
                //square
                currentplayer.setCD(this.coolDownSquare);
            }
            else if (currentplayer.playerType == 1)
            {
                //circle
                currentplayer.setCD(this.coolDownCircle);
            }
            else if (currentplayer.playerType == 2)
            {
                //triangle
                currentplayer.setCD(this.coolDownTriangle);
            }
        }
示例#2
0
        void OnGUI()
        {
            if (GUI.Button(new Rect(Screen.width - 150, Screen.height - 105, 100, 60), skipToGame))
            {
                SceneManager.LoadScene("scene");
            }

            if (GUI.Button(new Rect(Screen.width - 150, Screen.height - 165, 100, 60), quitText))
            {
                Application.Quit();
            }

//		GUI.Box (new Rect (970, 28, 200, 33), nextUpText);
            if (level == 0)
            {
//            GUIStyle myStyle = new GUIStyle(GUI.skin.GetStyle("label"));
//            myStyle.fontSize = 40;
                GUI.skin.box.alignment = TextAnchor.MiddleLeft;
                GUI.skin.box.fontSize  = 25;


                GUI.Box(new Rect(Screen.width / 2 - 250, Screen.height / 2 - 270, 500, 400), titleText);
                GUI.color              = Color.white;
                GUI.skin.box.fontSize  = 12;
                GUI.skin.box.alignment = TextAnchor.MiddleCenter;

//            if (GUI.Button(new Rect(Screen.width / 2 - 70, Screen.height / 2 + 50, 140, 60),tutorialText))
//            {
//                //level = 10;
//				SceneManager.LoadScene("main");
//				// Here, we can just load a differnet scene
//            }

                if (GUI.Button(new Rect(Screen.width / 2 - 150, Screen.height / 2 + 130, 300, 100), startText) || Input.GetKeyDown(KeyCode.Return))
                {
                    level = 1;

                    addPlayer(playerOrder[playerOrderIndex], 1, -4, -4);
                    playerOrderIndex++;

                    currentplayer = players [0];

                    print("firstplayertype: " + currentplayer.playerType);
                    if (currentplayer.playerType == 0)
                    {
                        //square
                        currentplayer.setCD(this.coolDownSquare);
                    }
                    else if (currentplayer.playerType == 1)
                    {
                        //circle
                        currentplayer.setCD(this.coolDownCircle);
                    }
                    else if (currentplayer.playerType == 2)
                    {
                        //triangle
                        currentplayer.setCD(this.coolDownTriangle);
                    }
                    //setHealthText ();
                    clock          = 0f;
                    shadow         = new List <Vector3> ();
                    shadowiterator = 0;
                    startitr       = false;
                    this.createInitialEnv();

                    GameObject bossObject = new GameObject();
                    tBoss      boss       = bossObject.AddComponent <tBoss>();
                    boss.init(this, bossCurrentLife);
                    THEBOSS = boss;
                    StartCoroutine(iterationSlowdown(3));
                }
//            if (GUI.Button(new Rect(25, Screen.height - 85, 110, 60), quitText)){
//                Application.Quit();
//            }

                if (GUI.Button(new Rect(25, Screen.height - 1555, 110, 60), skipToGame))
                {
                    SceneManager.LoadScene("scene");
                }
            }

            if (level == 10)      //level selction

            {
                for (int i = 1; i < 7; i++)
                {
                    GUIStyle BStyle = new GUIStyle(GUI.skin.GetStyle("Button"));
                    BStyle.fontSize = 25;
                    if (GUI.Button(new Rect(Screen.width / 8 + (i - 1) * Screen.width / 8, Screen.height / 2 - Screen.width / 8 / 2 + Screen.width / 8 / 4 / 2, Screen.width / 8 - Screen.width / 8 / 4, Screen.width / 8 - Screen.width / 8 / 4), i.ToString(), BStyle))
                    {
//                        resetLevel();
                        level = i;
//                        makeLevel();
                    }
                    if (GUI.Button(new Rect(100, Screen.height - 100, 200, 80), "Back To Menu"))
                    {
//                        resetLevel();
                        level = 0;
//                        makeLevel();
                    }
                }
            }


            if (level == 1)
            {
                if (this.gameover)
                {
                    GUI.skin.box.alignment = TextAnchor.MiddleLeft;
                    GUI.skin.box.fontSize  = 25;


                    if (GUI.Button(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 50, 600, 100), gameoverText))
                    {
                        SceneManager.LoadScene("tutorial");
                    }
                    GUI.color              = Color.white;
                    GUI.skin.box.fontSize  = 12;
                    GUI.skin.box.alignment = TextAnchor.MiddleCenter;
                }

                if (this.gamewon)
                {
                    foreach (tPlayer x in this.players)
                    {
                        Destroy(x.gameObject);
                    }
                    this.players.Clear();

                    foreach (tPlayer x in this.shadowPlayers)
                    {
                        Destroy(x.gameObject);
                    }

                    this.shadowPlayers.Clear();

                    //Destroy (this.THEBOSS.model1.gameObject);
                    //Destroy (this.THEBOSS.gameObject);
                    THEBOSS.transform.position = new Vector3(-200, -200, 0);

                    GUI.skin.box.alignment = TextAnchor.MiddleLeft;
                    GUI.skin.box.fontSize  = 25;


                    if (GUI.Button(new Rect(Screen.width / 2 - 300, Screen.height / 2 - 100, 600, 200), gamewonText))
                    {
                        SceneManager.LoadScene("scene");
                    }

                    GUI.color              = Color.white;
                    GUI.skin.box.fontSize  = 12;
                    GUI.skin.box.alignment = TextAnchor.MiddleCenter;
                }

                if (this.guiTransition)
                {
                    if (GUI.Button(new Rect(Screen.width / 2 - 200, Screen.height / 2 - 100, 400, 200), nextbossText))
                    {
                        this.guiTransition = false;
                    }
                }

// ****** TO reset the game - we will need to use a scene manager - Luxing take a look at this!**********
//		if(GUI.Button(new Rect((Screen.width- 100, Screen.height - 200, 500, 20), "Reset")) {
//			Application.
//		}

                /*GUI.Box(new Rect (1100, 28, 200, 33), scoreText);
                 * int s1 = score / 10000;
                 * int s2 = (score-10000*s1 )/ 1000;
                 * int s3 = (score-10000*s1-1000*s2 )/ 100;
                 * int s4 = (score-10000*s1-1000*s2 -100*s3) / 10;
                 * int s5 = score-10000*s1-1000*s2 -100*s3-10*s4;
                 * if (score >= 10000) {
                 *      GUI.Box (new Rect (1050, 58, 40, 40), Resources.Load<Texture> ("Textures/number" + s1));
                 * }
                 * if (score >= 1000) {
                 *      GUI.Box (new Rect (1080, 58, 40, 40), Resources.Load<Texture> ("Textures/number" + s2));
                 * }
                 * if (score >= 100) {
                 *      GUI.Box (new Rect (1110, 58, 40, 40), Resources.Load<Texture> ("Textures/number" + s3));
                 * }
                 * if (score >= 10) {
                 *      GUI.Box (new Rect (1140, 58, 40, 40), Resources.Load<Texture> ("Textures/number" + s4));
                 * }
                 * GUI.Box (new Rect (1170, 58, 40, 40), Resources.Load<Texture>("Textures/number"+s5));*/

                if (!this.gamewon && !this.gameover)
                {
                    if (currentplayer.playerType == 0)
                    {
                        GUI.Box(new Rect(50, Screen.height - 120, 300, 50), squareins);
                        GUI.Box(new Rect(50, Screen.height - 170, 300, 50), squareab);
                        // ******JUN LI ******* Look here for tutorial instructions
                        // The next one would be for the instruction for this tutorial
                        // Use the square as a shield to protect others
                        // Use shadows to kill the boss within 30 secs

                        //GUI.Box (new Rect (50, Screen.height-170, 300, 50), squareab);
                    }
                    else if (currentplayer.playerType == 1)
                    {
                        GUI.Box(new Rect(50, Screen.height - 120, 300, 50), circleins);
                        GUI.Box(new Rect(50, Screen.height - 170, 300, 50), circleab);
                        // The next one would be for the instruction for this tutorial
                        // Use special ability to kill the boss within 30 secs

                        //GUI.Box (new Rect (50, Screen.height-170, 300, 50), squareab);
                    }
                    else
                    {
                        GUI.Box(new Rect(50, Screen.height - 120, 300, 50), diamondins);
                        GUI.Box(new Rect(50, Screen.height - 170, 300, 50), diamondab);
                        // The next one would be for the instruction for this tutorial
                        // Use rapid fire ability to kill the boss within 30 secs

                        //GUI.Box (new Rect (50, Screen.height-170, 300, 50), squareab);
                    }
                }

                if (this.currentplayer.model.healthval > 3)
                {
                    GUI.color = Color.green;
                }
                else
                {
                    GUI.color = Color.red;
                }
                GUI.skin.box.alignment = TextAnchor.MiddleLeft;
                GUI.skin.box.fontSize  = 22;
                String ss = "";

                for (int i = 0; i < this.currentplayer.model.healthval; i++)
                {
                    ss += "I";
                }


                GUI.color              = Color.white;
                GUI.skin.box.fontSize  = 12;
                GUI.skin.box.alignment = TextAnchor.MiddleCenter;


                if (this.playerOrderIndex < playerLives)
                {
                    GUI.skin.box.alignment = TextAnchor.LowerCenter;
                    GUI.skin.box.fontSize  = 22;
                    GUI.Box(new Rect(900, 25, 110, 34), nextUpText);

                    int nextType = playerOrder [playerOrderIndex];
                    if (nextType == 0)
                    {
                        GUI.Box(new Rect(925, 60, 50, 50), this.forSq);
                    }
                    else if (nextType == 1)
                    {
                        GUI.Box(new Rect(925, 60, 50, 50), this.forC);
                    }
                    else if (nextType == 2)
                    {
                        GUI.Box(new Rect(925, 60, 50, 50), this.forT);
                    }
                }
                else
                {
                    //GUI.color = Color.red;
                    GUI.skin.box.fontSize = 22;
                    GUI.Box(new Rect(900, 19, 100, 40), lastLifeText);
                }
                GUI.skin.box.fontSize = 12;
            }
        }