コード例 #1
0
 private void diriger_vers_player2(PlayerController player, int modif_x = 0, int modif_y = 0, int modif_z = 0)
 {
     player.PointDeplacement = new Vector3(
                   myPlayer2.transform.position.x + modif_x,
                   myPlayer2.transform.position.y + modif_y,
                   myPlayer2.transform.position.z + modif_z);
 }
コード例 #2
0
        // --

        // Collisions
        void OnTriggerEnter(Collider other)
        {
            GameObject objet = other.gameObject;
            if (objet == myPlayer && phase == 5) //collision avec le Player & premier deplacement ?
            {
                end_time();
                BouttonPasse.SetActive(true);
                this.transform.position = //new Vector3(6, 0, 0);
                    ball.transform.position;
                phase++;
            }
            if (objet == ball && phase == 10) //collision avec la balle & lancer la balle premiere fois ?
            {
                end_time();
                //main
                foreach (Renderer r in flechesRenderer)
                    r.enabled = false;
                RondBlanc.enabled = false;
                //myPlayer
                BouttonTacle.SetActive(true);
                BouttonCourse.SetActive(false);

                update_Stats(MyPlayer_Controller, cCourse, cCourse, cCourse);

                //enemyPlayer 1
                play_t2 = Settings.Instance.Default_player["pwc"];
                enemyPlayer = Instantiate(player2_prefab, new Vector3(ball.transform.position.x, 1F, ball.transform.position.z), Quaternion.identity) as GameObject;
                play_t2.Team_id = 1;
                play_t2.Name = "G1aD0s";
                EnemyPlayer_Controller = (PlayerController)enemyPlayer.AddComponent(typeof(PlayerController));
                EnemyPlayer_Controller.Player = play_t2;
                EnemyPlayer_Controller.IsMine = false;
                EnemyPlayer_Controller.settablePointDeplacement = true;
                //enemyPlayer 2
                play_t3 = Settings.Instance.Default_player["pwc"];
                enemyPlayer2 = Instantiate(player2_prefab, new Vector3(40, 1, 40), Quaternion.identity) as GameObject;
                play_t3.Team_id = 1;
                play_t3.Name = "Manus";
                EnemyPlayer_Controller2 = (PlayerController)enemyPlayer2.AddComponent(typeof(PlayerController));
                EnemyPlayer_Controller2.Player = play_t3;
                EnemyPlayer_Controller2.IsMine = false;
                EnemyPlayer_Controller2.settablePointDeplacement = true;
                //enemyPlayer 3
                play_t4 = Settings.Instance.Default_player["pwc"];
                enemyPlayer3 = Instantiate(player2_prefab, new Vector3(40, 1, 40), Quaternion.identity) as GameObject;
                play_t4.Team_id = 1;
                play_t4.Name = "Red";
                EnemyPlayer_Controller3 = (PlayerController)enemyPlayer3.AddComponent(typeof(PlayerController));
                EnemyPlayer_Controller3.Player = play_t4;
                EnemyPlayer_Controller3.IsMine = false;
                EnemyPlayer_Controller3.settablePointDeplacement = true;
                //enemyPlayer 4
                play_t5 = Settings.Instance.Default_player["pwc"];
                enemyPlayer4 = Instantiate(player2_prefab, new Vector3(40, 1F, 40), Quaternion.identity) as GameObject;
                play_t5.Team_id = 1;
                play_t5.Name = "ganondorf";
                EnemyPlayer_Controller4 = (PlayerController)enemyPlayer4.AddComponent(typeof(PlayerController));
                EnemyPlayer_Controller4.Player = play_t5;
                EnemyPlayer_Controller4.IsMine = false;
                EnemyPlayer_Controller4.settablePointDeplacement = true;
                //enemyPlayer 5
                Player play_t6 = Settings.Instance.Default_player["pwc"];
                enemyPlayer5 = Instantiate(player2_prefab, new Vector3(40, 1F, 40), Quaternion.identity) as GameObject;
                play_t6.Team_id = 1;
                play_t6.Name = "B. Nashor";
                EnemyPlayer_Controller5 = (PlayerController)enemyPlayer5.AddComponent(typeof(PlayerController));
                EnemyPlayer_Controller5.Player = play_t6;
                EnemyPlayer_Controller5.IsMine = false;
                EnemyPlayer_Controller5.settablePointDeplacement = true;
                phase++;
            }
        }
コード例 #3
0
 // --
 private void update_Stats(PlayerController player, Color c1, Color c2, Color c3)
 {
     player.updateValuesPlayer(c1);
     player.updateValuesPlayer(c2);
     player.updateValuesPlayer(c3);
 }
コード例 #4
0
        // Update is called once per frame
        void Update()
        {
            switch (phase)
            {
                case 1:
                    if (!text_started)
                        text();
                    break;

                case 2: //creation du player + player2(mais il n'est pas disponible pour le moment) & changement emplacement du texte & 
                    //le premier player
                    play_t0 = Settings.Instance.Default_player["itec"];
                    myPlayer = Instantiate(player1_prefab, new Vector3(1F, 1F, 0F), Quaternion.identity) as GameObject;
                    play_t0.Team_id = 0;
                    play_t0.Name = "#Test</§!";
                    myPlayer.name = play_t0.Name + "-" + play_t0.Team_id;
                    MyPlayer_Controller = (PlayerController)myPlayer.AddComponent(typeof(PlayerController));
                    MyPlayer_Controller.Player = play_t0;
                    MyPlayer_Controller.IsMine = true;
                    //le deuxieme player
                    play_t1 = Settings.Instance.Default_player["lombrix"];
                    myPlayer2 = Instantiate(player1_prefab, new Vector3(40F, 1F, 40F), Quaternion.identity) as GameObject; //trop loin pour etre vu
                    play_t1.Team_id = 0;
                    play_t1.Name = "Captain America";
                    myPlayer2.name = play_t1.Name + "-" + play_t1.Team_id;
                    MyPlayer2_Controller = (PlayerController)myPlayer2.AddComponent(typeof(PlayerController));
                    MyPlayer2_Controller.Player = play_t1;
                    MyPlayer2_Controller.IsMine = true;

                    screentext.transform.position = new Vector2(screentext.transform.position.x, 700);
                    screetext2.transform.position = new Vector2(screentext.transform.position.x, 697);
                    phase++;
                    break;

                case 3:
                    if (!text_started)
                        text();
                    break;

                case 4: //assignation des 4 bouttons + 3 couleurs & seulement boutton course dispo & fleches main + rond blanc visibles
                    BouttonEsquive = myPlayer.transform.FindChild("menu(Clone)").FindChild("boutton1").gameObject;
                    BouttonTacle = myPlayer.transform.FindChild("menu(Clone)").FindChild("boutton2").gameObject;
                    BouttonPasse = myPlayer.transform.FindChild("menu(Clone)").FindChild("boutton3").gameObject;
                    BouttonCourse = myPlayer.transform.FindChild("menu(Clone)").FindChild("boutton4").gameObject;

                    cEsquive = MyPlayer_Controller.menucontroller.GetButtonsColor[0]; //couleur de l'esquive
                    cTacle = MyPlayer_Controller.menucontroller.GetButtonsColor[1];   //couleur du tacle
                    cPasse = MyPlayer_Controller.menucontroller.GetButtonsColor[2];   //couleur de la passe
                    cCourse = MyPlayer_Controller.menucontroller.GetButtonsColor[3];  //couleur de la course

                    BouttonEsquive.SetActive(false);
                    BouttonPasse.SetActive(false);
                    BouttonTacle.SetActive(false);

                    foreach (Renderer r in flechesRenderer)
                        r.enabled = true;
                    RondBlanc.enabled = true;
                    phase++;
                    break;

                //5 = collision main & activation maitrise de la balle

                case 6:
                    if (!text_started)
                        text();
                    break;

                case 7: //balle visile & main sur la ball (c'est juste du visuel)
                    ballRenderer.enabled = true;
                    this.transform.position = ball.transform.position;
                    phase++;
                    break;

                case 8: //recuperation balle & desactivation boutton course
                    if (ball.transform.IsChildOf(myPlayer.transform))
                    {
                        end_time();
                        this.transform.position = new Vector3(0.56F, 0.31F, 0);
                        BouttonCourse.SetActive(false);
                        phase++;
                    }
                    break;

                case 9:
                    if (!text_started)
                        text();
                    break;

                //10 = passe : collision balle & activation esquive + desactivation des autres & creation 5 joueurs adverse (1 seul visilbe) & 3 courses pour le joueur

                case 11:
                    if (!text_started)
                        text();
                    break;

                //12 = deplacement joueur adverse & tacle par le player

                case 13: //3 courses pour le joueur & seulement esquive disponible
                    if (!annim_started)
                    {
                        BouttonEsquive.SetActive(true);
                        BouttonTacle.SetActive(false);
                        BouttonPasse.SetActive(false);

                        update_Stats(MyPlayer_Controller, cCourse, cCourse, cCourse);
                        phase++;
                    }
                    break;

                case 14:
                    if (!text_started)
                        text();
                    break;

                //15 = deplacement joueur adverse & esquive reussie par notre joueur

                case 16:
                    if (!annim_started && !text_started)
                        text();
                    break;

                case 17: //tout les bouttons sont visibles pour le player & le player2 est la + il a la balle & changement de position player + adversaires
                    BouttonCourse.SetActive(true);
                    BouttonPasse.SetActive(true);
                    BouttonTacle.SetActive(true);

                    myPlayer.transform.position = new Vector3(-1.55F, 1, 15.69F);
                    myPlayer2.transform.position = new Vector3(5, 1, 16.21F);
                    enemyPlayer.transform.position = new Vector3(5, 1, 24);
                    enemyPlayer2.transform.position = new Vector3(-5, 1, 20);
                    enemyPlayer3.transform.position = new Vector3(9, 1, 20);
                    enemyPlayer4.transform.position = new Vector3(-3, 1, 12);
                    enemyPlayer5.transform.position = new Vector3(7, 1, 12);

                    MyPlayer_Controller.Player.BallHolder = false;
                    ball.transform.position = myPlayer2.transform.position;
                    ball.transform.parent = myPlayer2.transform.FindChild("perso");
                    MyPlayer2_Controller.Player.BallHolder = true;

                    phase++;
                    break;

                case 18:
                    if (!text_started)
                        text();
                    break;

                //19 = marquer un but

                case 20:
                    if (!text_started)
                        text();
                    break;

                case 21:
                    FadingManager.Instance.Fade();
                    break;
            } //switch
            time.update();
            if (Input.GetKeyDown(KeyCode.Space) && !text_started && !annim_started)
            {
                start_annim();
            }

            if (Input.GetKeyDown(KeyCode.Return) && text_started && !annim_started)
            {
                place++;
                text();
            }
        } //update