Ejemplo n.º 1
0
 public void Next()
 {
     if (TournamentUtil.Instance.IsInFinals)
     {
         Game.Instance.Nation02 = NationalSuits.getNationById(TournamentUtil.Instance.FinalsIds [1]);
     }
     else if (TournamentUtil.Instance.IsInSemiFinals)
     {
         Game.Instance.Nation02 = NationalSuits.getNationById(TournamentUtil.Instance.SemiFinalsIds [1]);
     }
     else if (TournamentUtil.Instance.IsInQuarter)
     {
         Game.Instance.Nation02 = NationalSuits.getNationById(TournamentUtil.Instance.QuarterIds [1]);
     }
     else if (TournamentUtil.Instance.IsInR16)
     {
         Game.Instance.Nation02 = NationalSuits.getNationById(TournamentUtil.Instance.R16Ids [1]);
     }
     Game.Instance.LandscapeId        = 255;
     Game.Instance.PlayerScore01      = 0;
     Game.Instance.PlayerScore02      = 0;
     Game.Instance.RemainingPlayers01 = Game.TEAM_PLAYERS;
     Game.Instance.RemainingPlayers02 = Game.TEAM_PLAYERS;
     Game.Instance.TimerActive        = true;
     Game.Instance.TimeRemained       = 120.2f;
     Application.LoadLevelAsync(Constants.LEVEL_GAMEPLAY);
 }
Ejemplo n.º 2
0
    void SetSemiFinals()
    {
        for (int i = 0; i < TournamentUtil.Instance.R16Ids.Length; i++)
        {
            byte id;
            if (i == 0)
            {
                id = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
            }
            else
            {
                id = TournamentUtil.Instance.R16Ids [i];
            }
            R16Flags [i].sprite2D = NationalSuits.getNationFlag(NationalSuits.getNationById(id));
        }

        for (int i = 0; i < TournamentUtil.Instance.QuarterIds.Length; i++)
        {
            byte id;
            if (i == 0)
            {
                id = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
            }
            else
            {
                id = TournamentUtil.Instance.QuarterIds [i];
            }
            QuartiFlags [i].sprite2D  = NationalSuits.getNationFlag(NationalSuits.getNationById(id));
            R16Goals [i * 2].text     = "" + TournamentUtil.Instance.R16Goals [i * 2];
            R16Goals [i * 2 + 1].text = "" + TournamentUtil.Instance.R16Goals [i * 2 + 1];
            if (TournamentUtil.Instance.R16Goals [i * 2] > TournamentUtil.Instance.R16Goals [i * 2 + 1])
            {
                R16Bg [i * 2].sprite2D = bgRosso;
            }
            else
            {
                R16Bg [i * 2 + 1].sprite2D = bgRosso;
            }
        }

        TournamentUtil.Instance.IsInSemiFinals = true;
        for (int i = 0; i < TournamentUtil.Instance.SemiFinalsIds.Length; i++)
        {
            Partita partita = CosaGoal(i, TournamentUtil.Instance.QuarterIds, TournamentUtil.Instance.QuarterGoals);
            SemifinaleFlags [i].sprite2D = NationalSuits.getNationFlag(NationalSuits.getNationById(partita.Id));
            QuartiGoals [i * 2].text     = "" + partita.Goal01;
            QuartiGoals [i * 2 + 1].text = "" + partita.Goal02;
            if (partita.Goal01 > partita.Goal02)
            {
                QuartiBg [i * 2].sprite2D = bgRosso;
            }
            else
            {
                QuartiBg [i * 2 + 1].sprite2D = bgRosso;
            }
            TournamentUtil.Instance.SemiFinalsIds [i]        = partita.Id;
            TournamentUtil.Instance.QuarterGoals [i * 2]     = partita.Goal01;
            TournamentUtil.Instance.QuarterGoals [i * 2 + 1] = partita.Goal02;
        }
    }
    public void Set()
    {
        switch (id)
        {
        case 0:
            title.text    = NationalSuits.getNationNameLong(Game.Instance.Nation01);
            flag.sprite2D = NationalSuits.getNationFlag(Game.Instance.Nation01);
            break;

        case 1:
            title.text    = NationalSuits.getNationNameLong(Game.Instance.Nation02);
            flag.sprite2D = NationalSuits.getNationFlag(Game.Instance.Nation02);
            break;
        }
    }
Ejemplo n.º 4
0
    void OnClick()
    {
        //UIGrid panel = NGUITools.FindInParents<UIGrid> (gameObject);
        //byte index = (byte)panel.GetIndex (this.transform);

        //byte nationId = (byte)(index + groupId * 4);
        if (Game.Instance.EditingNation01)
        {
            Game.Instance.Nation01 = NationalSuits.getNationById(nationId);
        }
        else if (Game.Instance.EditingNation02)
        {
            Game.Instance.Nation02 = NationalSuits.getNationById(nationId);
        }

        Game.Instance.EditingNation01 = false;
        Game.Instance.EditingNation02 = false;
    }
Ejemplo n.º 5
0
 void SetR16()
 {
     TournamentUtil.Instance.IsInR16 = true;
     for (int i = 0; i < TournamentUtil.Instance.R16Ids.Length; i++)
     {
         byte id;
         if (i == 0)
         {
             id = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
         }
         else
         {
             id = getId(TournamentUtil.Instance.R16Ids);
         }
         TournamentUtil.Instance.R16Ids [i] = id;
         R16Flags [i].sprite2D = NationalSuits.getNationFlag(NationalSuits.getNationById(id));
     }
 }
Ejemplo n.º 6
0
    Partita CosaGoal(int i, byte[] ids, byte[] goals)
    {
        Partita partita = new Partita();

        if (i == 0)
        {
            partita.Id     = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
            partita.Goal01 = Game.Instance.PlayerScore01;
            partita.Goal02 = Game.Instance.PlayerScore02;
        }
        else
        {
            partita.Goal01 = (byte)Random.Range(0, 5);
            partita.Goal02 = (byte)getGoal02(partita.Goal01);
            partita.Id     = partita.Goal01 > partita.Goal02 ? ids [i * 2] : ids [i * 2 + 1];
        }
        return(partita);
    }
Ejemplo n.º 7
0
    public void ConfigureOnlineFinished()
    {
        UniversalOnline.Instance.Progress = 90;
        byte[]     dataSmall = new byte[20];
        PlayerEnum player    = PlayerEnumUtils.GetCurrentPlayer();

        dataSmall [0] = Constants.CODE_CONFIGURE_MATCH;

        if (player == PlayerEnum.RIGHT)
        {
            int nationId02 = NationalSuits.getNationId(Game.Instance.Nation02);
            Game.Instance.LandscapeId = (byte)Random.Range(0, (int)Constants.BACKGROUNDS);
            dataSmall [1]             = Game.Instance.LandscapeId;
            dataSmall [2]             = Constants.CODE_NOTHING;
            dataSmall [3]             = (byte)nationId02;
            Game.Instance.Nation02    = NationalSuits.getNationById((byte)nationId02);
        }
        else
        {
            int nationId01 = NationalSuits.getNationId(Game.Instance.Nation01);
            dataSmall [1] = Constants.CODE_NOTHING;
            dataSmall [2] = (byte)nationId01;
            dataSmall [3] = Constants.CODE_NOTHING;

            Game.Instance.Nation01 = NationalSuits.getNationById((byte)nationId01);
        }
        if (Game.Instance.OnlinePlay)
        {
            PlayGamesPlatform.Instance.RealTime.SendMessageToAll(true, dataSmall);
        }
        else if (Game.Instance.BluetoothPlay)
        {
                                                #if UNITY_ANDROID
            SendInfoToServerMainMenu(dataSmall);
                                                #endif
        }
        UniversalOnline.Instance.State = UniversalOnline.States.Playing;

        if (UniversalOnline.Instance.TheOpponentIsReady)
        {
            Invoke("StartOnlineMatch", 2.5f);
        }
    }
Ejemplo n.º 8
0
    public static void ConfigurePlayer(GameObject player, NationalSuit suit)
    {
        if (BackgroundChooser.isSpace)
        {
            player.GetComponent <Rigidbody2D>().gravityScale = 0f;
        }

        Transform[] bodyDecorations     = new Transform[5];
        Transform[] thighDecorations    = new Transform[5];
        Transform[] shoulderDecorations = new Transform[5];


        // foreach child change the sprite color
        foreach (Transform child in player.transform)
        {
            //child is your child transform
            switch (child.name)
            {
            // HEAD
            case NationalSuit.NM_HAIR:
                child.GetComponent <SpriteRenderer> ().color = NationalSuits.HAIR_COLOR;
                break;

            case NationalSuit.NM_MOUTH:
                child.GetComponent <SpriteRenderer> ().color = NationalSuits.MOUTH_COLOR;
                break;

            case NationalSuit.NM_EAR:
            case NationalSuit.NM_EYEBROWS:
            case NationalSuit.NM_NOSE:
                child.GetComponent <SpriteRenderer> ().color = NationalSuits.getSkinColor(suit.Nation, false);
                break;

            case NationalSuit.NM_HEAD:
            case NationalSuit.NM_NECK:
            case NationalSuit.NM_KNEE_UP_1:
            case NationalSuit.NM_KNEE_UP_2:
            case NationalSuit.NM_KNEE_MIDDLE_1:
            case NationalSuit.NM_KNEE_MIDDLE_2:
            case NationalSuit.NM_KNEE_DOWN_1:
            case NationalSuit.NM_KNEE_DOWN_2:
                child.GetComponent <SpriteRenderer> ().color = NationalSuits.getSkinColor(suit.Nation, true);
                break;

            case NationalSuit.NM_COLLAR:
                child.GetComponent <SpriteRenderer> ().color = suit.NationalColors.Collar;
                break;

            case NationalSuit.NM_THIGH_UP:
                child.GetComponent <SpriteRenderer> ().color = suit.NationalColors.Pants;
                break;

            case NationalSuit.NM_THIGH_DOWN_1:
                child.GetComponent <SpriteRenderer> ().color = suit.NationalColors.Pants;
                foreach (Transform child2 in child)
                {
                    switch (child2.name)
                    {
                    case NationalSuit.NM_THIGH_DC_1_1:
                        thighDecorations [0] = child2;
                        break;
                    }
                }
                break;

            case NationalSuit.NM_THIGH_DOWN_2:
                child.GetComponent <SpriteRenderer> ().color = suit.NationalColors.Pants;
                foreach (Transform child2 in child)
                {
                    switch (child2.name)
                    {
                    case NationalSuit.NM_THIGH_DC_1_2:
                        thighDecorations [1] = child2;
                        break;
                    }
                }
                break;

            // OTHER
            case NationalSuit.NM_BODY:
                child.GetComponent <SpriteRenderer> ().color = suit.NationalColors.Jersey;
                foreach (Transform child2 in child)
                {
                    switch (child2.name)
                    {
                    case NationalSuit.NM_BODY_DC_1:
                        bodyDecorations [0] = child2;
                        break;

                    case NationalSuit.NM_BODY_DC_2:
                        bodyDecorations [1] = child2;
                        break;

                    case NationalSuit.NM_BODY_DC_3:
                        bodyDecorations [2] = child2;
                        break;

                    case NationalSuit.NM_BODY_DC_4:
                        bodyDecorations [3] = child2;
                        break;

                    case NationalSuit.NM_BODY_DC_5:
                        bodyDecorations [4] = child2;
                        break;
                    }
                }
                break;

            case NationalSuit.NM_SHOULDER:
                child.GetComponent <SpriteRenderer> ().color = suit.NationalColors.Jersey;
                foreach (Transform child2 in child)
                {
                    switch (child2.name)
                    {
                    case NationalSuit.NM_SHOULDER_DC_1:
                        shoulderDecorations [0] = child2;
                        break;

                    case NationalSuit.NM_SHOULDER_DC_2:
                        shoulderDecorations [1] = child2;
                        break;

                    case NationalSuit.NM_SHOULDER_DC_3:
                        shoulderDecorations [2] = child2;
                        break;

                    case NationalSuit.NM_SHOULDER_DC_4:
                        shoulderDecorations [3] = child2;
                        break;

                    case NationalSuit.NM_SHOULDER_DC_5:
                        shoulderDecorations [4] = child2;
                        break;

                    case NationalSuit.NM_ELBOW_UP:
                    case NationalSuit.NM_ELBOW_MIDDLE:
                    case NationalSuit.NM_ELBOW_DOWN:
                        child2.GetComponent <SpriteRenderer> ().color = NationalSuits.getSkinColor(suit.Nation, true);
                        break;
                    }
                }
                break;
            }

            int  thighDecoration, bodyDecoration, shoulderDecoration;
            byte i;

            bodyDecoration     = NationalSuits.getDecorations(suit.Nation) [0];
            shoulderDecoration = NationalSuits.getDecorations(suit.Nation) [1];
            thighDecoration    = NationalSuits.getDecorations(suit.Nation) [2];



            // disable not selected decorations
            for (i = 0; i < thighDecorations.Length; i++)
            {
                if (thighDecorations [i] == null)
                {
                    continue;
                }

                if (thighDecoration == 0)
                {
                    thighDecorations [i].gameObject.SetActive(false);
                }
                else
                {
                    thighDecorations [i].gameObject.GetComponent <SpriteRenderer> ().color = suit.NationalColors.ThighDc;
                }
            }
            for (i = 0; i < bodyDecorations.Length; i++)
            {
                if (bodyDecorations [i] == null)
                {
                    continue;
                }

                if (i != bodyDecoration - 1)
                {
                    bodyDecorations [i].gameObject.SetActive(false);
                }
                else if (bodyDecoration == 5)
                {
                    // the fifth is the german decoration, we don't change color
                }
                else
                {
                    bodyDecorations [i].gameObject.GetComponent <SpriteRenderer> ().color = suit.NationalColors.BodyDc;
                }
            }
            for (i = 0; i < shoulderDecorations.Length; i++)
            {
                if (shoulderDecorations [i] == null)
                {
                    continue;
                }

                if (i != shoulderDecoration - 1)
                {
                    shoulderDecorations [i].gameObject.SetActive(false);
                }
                else
                {
                    shoulderDecorations [i].gameObject.GetComponent <SpriteRenderer> ().color = suit.NationalColors.ShoulderDc;
                }
            }
        }
    }
Ejemplo n.º 9
0
    public void OnMessageReceived(byte[] data)
    {
        if (ball == null)
        {
            ball = GameObject.FindGameObjectWithTag(Constants.TAG_BALL);
        }

        switch (data [0])                           // what to update
        {
        case Constants.CODE_BALL_AND_SHOOT:

            posX = BitConverter.ToSingle(data, 1 + 4 * 0);
            posY = BitConverter.ToSingle(data, 1 + 4 * 1);
            cos  = BitConverter.ToSingle(data, 1 + 4 * 2);
            sin  = BitConverter.ToSingle(data, 1 + 4 * 3);

            posBallX = BitConverter.ToSingle(data, 1 + 4 * 4);
            posBallY = BitConverter.ToSingle(data, 1 + 4 * 5);
            ballVelX = BitConverter.ToSingle(data, 1 + 4 * 6);
            ballVelY = BitConverter.ToSingle(data, 1 + 4 * 7);
            PlayerShooter.Instance.Shoot(posX, posY, cos, sin);
            ball.transform.GetComponent <Rigidbody2D>().velocity = new Vector2(ballVelX, ballVelY);
            ball.transform.position = new Vector3(posBallX, posBallY, 0);
            break;

        case Constants.CODE_GOAL:
            Camera.main.GetComponent <GamePlaySetup> ().FakeGoal();
            Game.Instance.PlayerScore01 = data [1];
            Game.Instance.PlayerScore02 = data [2];
            Camera.main.GetComponent <GamePlaySetup> ().UpdateScore();
            break;

        case Constants.CODE_BALL:
            posBallX = BitConverter.ToSingle(data, 1 + 4 * 0);
            posBallY = BitConverter.ToSingle(data, 1 + 4 * 1);
            ballVelX = BitConverter.ToSingle(data, 1 + 4 * 2);
            ballVelY = BitConverter.ToSingle(data, 1 + 4 * 3);
            ball.transform.GetComponent <Rigidbody2D>().velocity = new Vector2(ballVelX, ballVelY);
            ball.transform.position = new Vector3(posBallX, posBallY, 0);
            break;

        case Constants.CODE_TIME:
            Game.Instance.TimeRemained = data [1];
            Camera.main.GetComponent <GamePlaySetup> ().UpdateGuiTime();
            break;

        case Constants.CODE_REMAINING_PLAYERS:
            Game.Instance.RemainingPlayers01 = data [1];
            Game.Instance.RemainingPlayers02 = data [2];
            Camera.main.GetComponent <GamePlaySetup> ().UpdateLifeBar();
            break;

        case Constants.CODE_CONFIGURE_MATCH:
            if (data [1] != Constants.CODE_NOTHING)
            {
                Game.Instance.LandscapeId = data [1];
            }
            if (data [2] != Constants.CODE_NOTHING)
            {
                Game.Instance.Nation01 = NationalSuits.getNationById(data [2]);
            }
            if (data [3] != Constants.CODE_NOTHING)
            {
                Game.Instance.Nation02 = NationalSuits.getNationById(data [3]);
            }
            theOpponentIsReady = true;
            break;

        case Constants.CODE_ALL_READY:
            UniversalOnline.Instance.Progress = 0;
            theOpponentIsReady = false;
            //Application.LoadLevel (Constants.LEVEL_GAMEPLAY);
                        #if UNITY_PRO_LICENSE
            Application.LoadLevelAsync(Constants.LEVEL_GAMEPLAY);
                        #else
            Application.LoadLevel(Constants.LEVEL_GAMEPLAY);
                        #endif
            break;
        }
    }
Ejemplo n.º 10
0
    void SetWinner()
    {
        for (int i = 0; i < TournamentUtil.Instance.R16Ids.Length; i++)
        {
            byte id;
            if (i == 0)
            {
                id = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
            }
            else
            {
                id = TournamentUtil.Instance.R16Ids [i];
            }
            R16Flags [i].sprite2D = NationalSuits.getNationFlag(NationalSuits.getNationById(id));
        }

        for (int i = 0; i < TournamentUtil.Instance.QuarterIds.Length; i++)
        {
            byte id;
            if (i == 0)
            {
                id = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
            }
            else
            {
                id = TournamentUtil.Instance.QuarterIds [i];
            }
            QuartiFlags [i].sprite2D  = NationalSuits.getNationFlag(NationalSuits.getNationById(id));
            R16Goals [i * 2].text     = "" + TournamentUtil.Instance.R16Goals [i * 2];
            R16Goals [i * 2 + 1].text = "" + TournamentUtil.Instance.R16Goals [i * 2 + 1];
            if (TournamentUtil.Instance.R16Goals [i * 2] > TournamentUtil.Instance.R16Goals [i * 2 + 1])
            {
                R16Bg [i * 2].sprite2D = bgRosso;
            }
            else
            {
                R16Bg [i * 2 + 1].sprite2D = bgRosso;
            }
        }

        for (int i = 0; i < TournamentUtil.Instance.SemiFinalsIds.Length; i++)
        {
            byte id;
            if (i == 0)
            {
                id = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
            }
            else
            {
                id = TournamentUtil.Instance.SemiFinalsIds [i];
            }
            SemifinaleFlags [i].sprite2D = NationalSuits.getNationFlag(NationalSuits.getNationById(id));
            QuartiGoals [i * 2].text     = "" + TournamentUtil.Instance.QuarterGoals [i * 2];
            QuartiGoals [i * 2 + 1].text = "" + TournamentUtil.Instance.QuarterGoals [i * 2 + 1];
            if (TournamentUtil.Instance.QuarterGoals [i * 2] > TournamentUtil.Instance.QuarterGoals [i * 2 + 1])
            {
                QuartiBg [i * 2].sprite2D = bgRosso;
            }
            else
            {
                QuartiBg [i * 2 + 1].sprite2D = bgRosso;
            }
        }

        for (int i = 0; i < TournamentUtil.Instance.FinalsIds.Length; i++)
        {
            byte id;
            if (i == 0)
            {
                id = (byte)NationalSuits.getNationId(Game.Instance.Nation01);
            }
            else
            {
                id = TournamentUtil.Instance.FinalsIds [i];
            }
            FInaleFlags [i].sprite2D         = NationalSuits.getNationFlag(NationalSuits.getNationById(id));
            SemifinaleGoals [i * 2].text     = "" + TournamentUtil.Instance.SemiFinalsGoals [i * 2];
            SemifinaleGoals [i * 2 + 1].text = "" + TournamentUtil.Instance.SemiFinalsGoals [i * 2 + 1];
            if (TournamentUtil.Instance.SemiFinalsGoals [i * 2] > TournamentUtil.Instance.SemiFinalsGoals [i * 2 + 1])
            {
                SemifinaleBg [i * 2].sprite2D = bgRosso;
            }
            else
            {
                SemifinaleBg [i * 2 + 1].sprite2D = bgRosso;
            }
        }

        Partita partita = CosaGoal(0, TournamentUtil.Instance.FinalsIds, TournamentUtil.Instance.FinalsIds);

        FInaleGoals [0].text = "" + partita.Goal01;
        FInaleGoals [1].text = "" + partita.Goal02;
        if (partita.Goal01 > partita.Goal02)
        {
            FInaleBg [0].sprite2D = bgRosso;
        }
        else
        {
            FInaleBg [1].sprite2D = bgRosso;
        }
    }
Ejemplo n.º 11
0
    void Start()
    {
        isInGoldenGoal = false;
        // stop timer, but play the game
        Game.Instance.TimerActive = false;
        CancelInvoke("PrepareEnemie");
        Game.Instance.SetGameActive(true);
        // distance from the screen
        float dFromScreen = 4f;

        points01 = new PointsManager();
        points02 = new PointsManager();
        canShoot = false;
        float doorPos = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x;

        currentPlayer = PlayerEnumUtils.GetCurrentPlayer();
        offlineMatch  = Game.Instance.OnlinePlay == false && Game.Instance.BluetoothPlay == false && Game.Instance.LocalMultiPlayer == false;

        if (SavedVariables.FirstPlay)
        {
            SavedVariables.FirstPlay = false;
            tutorial.SetActive(true);
        }

        // disable some components
        MenuPause.SetActive(false);
        MenuGameEnded.SetActive(false);
        if (Game.Instance.TournamentMode)
        {
            GameEndedRowOffline.SetActive(false);
            GameEndedRowOnline.SetActive(false);
            GameEndedTournament.SetActive(true);
            RedoButton.enabled = false;
            RedoButton.SetState(UIButton.State.Disabled, true);
        }
        else if (Game.Instance.OnlinePlay || Game.Instance.BluetoothPlay)
        {
            GameEndedRowOffline.SetActive(false);
            GameEndedRowOnline.SetActive(true);
            GameEndedTournament.SetActive(false);
        }
        else if (Game.Instance.LocalPlay || Game.Instance.LocalMultiPlayer)
        {
            GameEndedRowOffline.SetActive(true);
            GameEndedRowOnline.SetActive(false);
            GameEndedTournament.SetActive(false);
        }
        Points01.enabled = false;
        Points02.enabled = false;

        if (Game.Instance.BluetoothPlay || Game.Instance.OnlinePlay)
        {
            PauseButton.SetActive(false);
        }
        else
        {
            EndMatchButton.SetActive(false);
        }

        // get the letters distance
        for (byte i = 0; i < letters.Length; i++)          // count the distance from the letter on the left
        {
            if (i == 0)
            {
                lettersDistances[i] = 0;
            }
            else
            {
                lettersDistances[i] = letters[i].transform.position.x - letters[i - 1].transform.position.x;
            }
        }

        // SET WALLS POSITION
        {
            //Move each wall to its edge location:
            topDeath.size   = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x * 2 * 2, 1);
            topDeath.offset = new Vector2(0, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y + 0.5f + dFromScreen);

            bottomDeath.size   = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x * 2 * 2, 1);
            bottomDeath.offset = new Vector2(0, Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).y - 0.5f - dFromScreen);

            leftDeath.size   = new Vector2(1, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y * 2 * 2);;
            leftDeath.offset = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).x - 0.5f - dFromScreen, 0);

            rightDeath.size   = new Vector2(1, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y * 2 * 2);
            rightDeath.offset = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x + 0.5f + dFromScreen, 0);

            //Move each wind to its edge location:
            topWall.size   = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x * 2, 1);
            topWall.offset = new Vector2(0, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y + 0.5f);

            bottomWall.size   = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x * 2, 1);
            bottomWall.offset = new Vector2(0, Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).y - 0.5f);

            leftWall.size   = new Vector2(1, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y * 2);;
            leftWall.offset = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).x - 0.5f, 0);

            rightWall.size   = new Vector2(1, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y * 2);
            rightWall.offset = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x + 0.5f, 0);
        }
        // SETUP BALL AND DOORS
        {
            // move down the referee
            Whistle(true);

            // doors

            doorLeft.transform.position  = new Vector3(-doorPos, 0, 0);
            doorRight.transform.position = new Vector3(+doorPos, 0, 0);
        }

        GameObject player01   = GameObject.Instantiate(playerBase, Vector3.zero, Quaternion.identity) as GameObject;
        GameObject player02   = GameObject.Instantiate(playerBase, Vector3.zero, Quaternion.identity) as GameObject;
        GameObject goalKeeper = GameObject.Instantiate(playerBase, Vector3.zero, Quaternion.identity) as GameObject;

        while (Game.Instance.Nation01 == Nationals.NONE)
        {
            System.Array A = System.Enum.GetValues(typeof(Nationals));
            Nationals    V = (Nationals)A.GetValue(UnityEngine.Random.Range(0, A.Length));
            Game.Instance.Nation01 = V;
        }
        while (Game.Instance.Nation02 == Nationals.NONE || Game.Instance.Nation02 == Game.Instance.Nation01)
        {
            System.Array A = System.Enum.GetValues(typeof(Nationals));
            Nationals    V = (Nationals)A.GetValue(UnityEngine.Random.Range(0, A.Length));
            Game.Instance.Nation02 = V;
        }
        Flag01.sprite2D = NationalSuits.getNationFlag(Game.Instance.Nation01);
        Flag02.sprite2D = NationalSuits.getNationFlag(Game.Instance.Nation02);

        PlayerName01.text = NationalSuits.getNationNameShort(Game.Instance.Nation01);
        PlayerName02.text = NationalSuits.getNationNameShort(Game.Instance.Nation02);
        NationalSuit nationalSuit01 = NationalSuits.getSuitForNation(Game.Instance.Nation01);
        NationalSuit nationalSuit02 = NationalSuits.getSuitForNation(Game.Instance.Nation02);
        //LifeBarContent01.color = nationalSuit01.NationalColors.Jersey;
        //LifeBarContent02.color = nationalSuit02.NationalColors.Jersey;


        // SETUP PLAYERS
        {
            // set suit colors
            PlayerConfigurer.ConfigurePlayer(player01, nationalSuit01);
            PlayerConfigurer.ConfigurePlayer(player02, nationalSuit02);
            PlayerConfigurer.ConfigurePlayer(goalKeeper, NationalSuits.getGoalKeeperSuit());
            // create many copies

            PlayerShooter.Instance.SetupPlayers(player01, player02, goalKeeper);

            Destroy(player01);
            Destroy(player02);
            Destroy(goalKeeper);
        }
    }