Esempio n. 1
0
 private void OnDestroy()
 {
     if (current == this)
     {
         current = null;
     }
 }
Esempio n. 2
0
    public MatchStatsScreen(MatchStartData matchData, FrontEndConstants consts, ScreenUI owner)
        : base(matchData, consts, owner)
    {
        LevelManager manager = WorldConstants.MatchController.GetComponent <LevelManager>();

        players        = WorldConstants.ColTracker.Actors;
        statsToDisplay = Stats.GetStats(manager.MatchRules, players);
    }
Esempio n. 3
0
 private void Awake()
 {
     //Cache
     screenUI         = FindObjectOfType <ScreenUI>();
     playerController = GetComponent <PlayerController>();
     healthPoints     = GetComponentsInChildren <SpriteRenderer>();
     //Subscribe to player events
     playerController.onHpChanged += SetHpBar;
     playerController.onSetFocus  += SetFocus;
 }
Esempio n. 4
0
 void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
Esempio n. 5
0
    public void SetScreen(ScreenUI screen)
    {
        CurrentScreen = screen;

        taskScreen.SetActive(CurrentScreen == ScreenUI.Task);
        createScreen.SetActive(CurrentScreen == ScreenUI.Create);
        settingsScreen.SetActive(CurrentScreen == ScreenUI.Settings);
        infoScreen.SetActive(CurrentScreen == ScreenUI.Info);

        //invoke when not null
        OnScreenChange?.Invoke();
    }
Esempio n. 6
0
 private void Awake()
 {
     if (current && current != this)
     {
         Destroy(gameObject);
         return;
     }
     canvas  = GetComponent <Canvas>();
     current = this;
     DontDestroyOnLoad(gameObject);
     initText.text    = string.Empty;
     initText.enabled = false;
 }
    public LobbyMenuScreen(MatchStartData matchStartData, FrontEndConstants consts, ScreenUI owner)
        : base(matchStartData, consts, owner)
    {
        for (int i = 0; i < Owner.ControlsTextures.Length; ++i)
        {
            controlContents[i] = new GUIContent(Owner.ControlsTextures[i]);
        }

        playerDatas[0] = new PlayerData(0);
        playerDatas[1] = new PlayerData(1);
        playerDatas[2] = null;
        playerDatas[3] = null;
    }
Esempio n. 8
0
    // Update is called once per frame
    void Update()
    {
        if (bFading)
        {
            Vector3 Offset = CalculateSpeed();
            TitleImage.transform.Translate(Offset);
            StartButton.transform.Translate(Offset);
            Intro.transform.Translate(-Offset);

            if (TitleImage.transform.position.x < -1000.0f)
            {
                bFading = false;
                ScreenUI.SetActive(true);
            }
        }
    }
Esempio n. 9
0
    private void ShowScreen(ScreenUI screenUI)
    {
        foreach (var screen in _screens)
        {
            screen.SetActive(false);
        }

        if (screenUI == ScreenUI.MainMenu)
        {
            ShowMainMenu();
        }
        else if (screenUI == ScreenUI.InGame)
        {
            inGameUI.SetActive(true);
        }
    }
Esempio n. 10
0
    // Use this for initialization
    void Start()
    {
        canvas       = GameObject.Find("Canvas").gameObject;
        screenUi     = canvas.GetComponent <ScreenUI>();
        gunScope     = canvas.transform.Find("snipe").gameObject;
        snipe        = gunScope.GetComponent <Image>();
        screenCenter = new Vector3(Screen.width / 2, Screen.height / 2);

        audioSource = GetComponent <AudioSource>();
        sparkle     = (GameObject)Resources.Load("prefabs/Sparkle");


        _chargedBullet = 30;
        _maxBullet     = 30;
        _bulletBox     = 150;
        _isShootable   = true;
        _isRelaoding   = false;
        _isZooming     = false;
    }
    private void Start()
    {
        camController = FindObjectOfType <CameraController>();

        ScreenUI initialScreen = screens
                                 .First(inScreen => inScreen.gameState == GameManager.instance.State.Value);

        initialScreen.animator.SetBool("Enter", true);

        camController.onEnterGame.AddListener(() =>
        {
            ScreenUI screen = screens
                              .First(inScreen => inScreen.gameState == GameState.Game);

            screen?.animator.SetBool("Enter", true);
        });

        camController.onExitGame.AddListener(() =>
        {
            ScreenUI screen = screens
                              .First(inScreen => inScreen.gameState == GameState.Game);

            screen?.animator.SetBool("Enter", false);
        });


        camController.onEnterMenu.AddListener(() =>
        {
            ScreenUI screen = screens
                              .First(inScreen => inScreen.gameState == GameState.Menu);

            screen?.animator.SetBool("Enter", true);
        });

        camController.onExitMenu.AddListener(() =>
        {
            ScreenUI screen = screens
                              .First(inScreen => inScreen.gameState == GameState.Menu);

            screen?.animator.SetBool("Enter", false);
        });
    }
Esempio n. 12
0
        void MakeHealthManaGumps()
        {
            mUIMats = new MatLib(mGD, mSKeeper);
            mUIMats.CreateMaterial("Text");
            mUIMats.SetMaterialEffect("Text", "2D.fx");
            mUIMats.SetMaterialTechnique("Text", "Text");

            mUI = new ScreenUI(mGD.GD, mUIMats, 16);

            Vector4 healthColour = Vector4.UnitX + Vector4.UnitW;
            Vector4 manaColour   = Vector4.UnitZ + Vector4.UnitW;

            mUI.AddGump("UI\\HMBubble", "HealthBubble", healthColour,
                        Vector2.UnitX * 20f + Vector2.UnitY * 520f,
                        Vector2.One * 1.5f);

            mUI.AddGump("UI\\HMBubble", "ManaBubble", manaColour,
                        Vector2.UnitX * 1070f + Vector2.UnitY * 520f,
                        Vector2.One * 1.5f);
        }
Esempio n. 13
0
 public GameMain(GraphicsDeviceManager graphics, ContentManager content, GraphicsDevice graphicsDevice)
 {
     graphicsMain       = graphics;
     contentMain        = content;
     graphicsDeviceMain = graphicsDevice;
     //Nastavimo velikost igralnega zaslona
     graphicsMain.PreferredBackBufferWidth  = screenWidth;
     graphicsMain.PreferredBackBufferHeight = screenHeight;
     graphicsMain.ApplyChanges();
     LoadContent();
     //Inicializacija kamnov in metkov
     numberOfRocks   = 1;
     numberOfBullets = 3;
     playerHP        = 3;
     //Čas od kadar smo vstrelili
     timeSinceShot = 0;
     // Init sprites
     npc_testing = new AI(graphicsDeviceMain, 3);
     //ufo_testing = new AIUFO(this.GraphicsDevice);
     character           = new PlayerCharacter(graphicsDeviceMain);
     my_bullets          = new List <Projectile>();
     my_rocks            = new List <Planetoids>();
     gameLogic           = new GameLogic(numberOfRocks, playerHP, character, my_rocks);
     ui_rocks_NUMOFROCKS = new ScreenUI(contentMain, 210, 20, "NUM.OF ROCKS");
     ui_rocks_REMAIN     = new ScreenUI(contentMain, 210, 40, gameLogic.getNumRocks().ToString());
     ui_score_SCORE      = new ScreenUI(contentMain, 55, 20, "SCORE");
     ui_score_NUMS       = new ScreenUI(contentMain, 55, 40, gameLogic.getScore().ToString());
     ui_playerHP         = new ScreenUI(graphicsDeviceMain, screenWidth - 100, 40, 3);
     ui_but_back         = new ScreenUI(graphicsDeviceMain, screenWidth - 150, 40);
     ui_playerHP_NUMS    = new ScreenUI(contentMain, screenWidth - 60, 40, "x " + playerHP.ToString());
     ui_wave_NUMS        = new ScreenUI(contentMain, screenWidth / 2, 40, "WAVE: " + gameLogic.getWave());
     my_backs            = new BackgroundLoader(graphicsDeviceMain);
     for (int i = 0; i < numberOfRocks; i++)
     {
         my_rocks.Add(new Planetoids(graphicsDeviceMain));
     }
     for (int j = 0; j < numberOfBullets; j++)
     {
         my_bullets.Add(new Projectile(graphicsDeviceMain, contentMain));
     }
 }
Esempio n. 14
0
        internal LightExplorer(GraphicsDevice gd, StuffKeeper sk)
        {
            mGD = gd;
            mSK = sk;

            mResX = gd.RendForm.ClientRectangle.Width;
            mResY = gd.RendForm.ClientRectangle.Height;

            mGD.eDeviceLost += OnDeviceLost;

            mEForm.Visible = true;
            mOForm.Visible = true;

            mEForm.eOpenGBSP += OnOpenGBSP;

            mFontMats = new MatLib(gd, sk);

            mFontMats.CreateMaterial("Text");
            mFontMats.SetMaterialEffect("Text", "2D.fx");
            mFontMats.SetMaterialTechnique("Text", "Text");

            mFonts = sk.GetFontList();

            mST  = new ScreenText(gd.GD, mFontMats, mFonts[0], 1000);
            mSUI = new ScreenUI(gd.GD, mFontMats, 100);

            mTextProj = Matrix.OrthoOffCenterLH(0, mResX, mResY, 0, 0.1f, 5f);

            Vector4 color = Vector4.UnitY + (Vector4.UnitW * 0.15f);

            mSUI.AddGump("UI\\CrossHair", "CrossHair", Vector4.One,
                         Vector2.UnitX * ((mResX / 2) - 16)
                         + Vector2.UnitY * ((mResY / 2) - 16),
                         Vector2.One);

            mST.AddString(mFonts[0], "Face Index: " + mFaceIndex, "FaceIndex",
                          color, Vector2.UnitX * 20f + Vector2.UnitY * 400f, Vector2.One);
            mST.AddString(mFonts[0], "Face aimed at: " + mFaceAimedAt, "FaceAimedAt",
                          color, Vector2.UnitX * 20f + Vector2.UnitY * 420f, Vector2.One);
        }
Esempio n. 15
0
    void Start()
    {
        timeElapsed = 0;
        timeAllowed = 90;

        //Turn cursor off.
        Cursor.visible = false;

        currentTask = new Task();

        currentTask.fulfilments.Add(new Fulfilment(gameObject.GetComponent <TraitManager>().traitLibrary[0], 2));

        GetComponent <EventManager>().addScore.AddListener(AddScore);

        //Get UI
        screenUI = GameObject.Find("ScreenUI").GetComponent <ScreenUI>();

        StartCoroutine(StartTimer());

        audioManager = GetComponent <AudioManager>();

        SessionPause(false);
    }
Esempio n. 16
0
 public MatchScreen(MatchStartData matchData, FrontEndConstants consts, ScreenUI owner)
     : base(matchData, consts, owner)
 {
     manager = WorldConstants.Creator.CreateMatchController().GetComponent <LevelManager>();
 }
Esempio n. 17
0
        public void Update(GameTime gameTime)
        {
            ui_but_back.Update(gameTime);
            if (ui_but_back.getIsButtonBackPressed())
            {
                ui_but_back.setIsButtonBackPressed(false);
                isBackPressed = true;
            }
            if (gameLogic.getNumRocks() <= 0)
            {
                gameLogic.incrementWave();
                ui_wave_NUMS.UpdateValues("WAVE: " + gameLogic.getWave());
                numberOfRocks = 10;
                invulnTimer   = 0.0f;
                gameLogic.SetNumberOfRocks(numberOfRocks);
                for (int i = 0; i < numberOfRocks; i++)
                {
                    my_rocks.Add(new Planetoids(graphicsDeviceMain));
                }
            }
            timeSinceShot += (float)gameTime.ElapsedGameTime.TotalSeconds;
            Vector2 debug_direction = character.getDirection();
            //Console.WriteLine(debug_direction);
            //Trenutno stanje tipkovnice
            KeyboardState state = Keyboard.GetState();

            updateGameParralax(state, gameTime);
            //Preverim kontrole igralca, preverim, ali gre igralec skozi
            updateGameRocksCollision(gameTime);
            if (gameLogic.getPlayerHP() > 0)
            {
                if (!character.getIsAlive())
                {
                    respawnTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
                }
                else
                {
                    character.checkControls(state, screenWidth, screenHeight, my_rocks);
                    //Posodabljanje metkov, v primeru da metrki ne letijo jih posodabljam z ladjo
                    updateGameBullets(state);
                }
                if (respawnTimer >= 1.0f)
                {
                    invulnTimer = 0.0f;
                    gameLogic.setPlayerHp(-1);
                    ui_playerHP_NUMS.UpdateValues("x " + gameLogic.getPlayerHP());
                    ui_playerHP = new ScreenUI(graphicsDeviceMain, screenWidth - 100, 40, (int)gameLogic.getPlayerHP());
                    //Console.WriteLine("beep respawn");
                    character.setPosition(new Vector2(screenWidth / 2, screenHeight / 2));
                    respawnTimer = 0;
                    character.setIsAlive(true);
                    foreach (Projectile p in my_bullets)
                    {
                        p.RefreshProjectile();
                    }
                }
            }
            //Posodabljanje parallax backgrounda
            //Posodabljanje kolizij in kamnov
            npc_testing.UpdateAI(character, gameTime);
            //ufo_testing.UpdateAI(character, gameTime);
            ui_score_NUMS.UpdateValues(gameLogic.getScore().ToString());
            ui_rocks_REMAIN.UpdateValues(gameLogic.getNumRocks().ToString());
            invulnTimer += (float)gameTime.ElapsedGameTime.TotalSeconds;
        }
Esempio n. 18
0
        const float InvertIncrement = 0.01f;            //10ms


        internal Game(GraphicsDevice gd, string gameRootDir)
        {
            mGD          = gd;
            mGameRootDir = gameRootDir;
            mResX        = gd.RendForm.ClientRectangle.Width;
            mResY        = gd.RendForm.ClientRectangle.Height;

            mSKeeper = new StuffKeeper();

            mSKeeper.eCompileNeeded += SharedForms.ShaderCompileHelper.CompileNeededHandler;
            mSKeeper.eCompileDone   += SharedForms.ShaderCompileHelper.CompileDoneHandler;

            mSKeeper.Init(mGD, gameRootDir);

            mFontMats = new MatLib(gd, mSKeeper);
            mCPrims   = new CommonPrims(gd, mSKeeper);

            mFonts = mSKeeper.GetFontList();

            mFontMats.CreateMaterial("Text");
            mFontMats.SetMaterialEffect("Text", "2D.fx");
            mFontMats.SetMaterialTechnique("Text", "Text");

            mST  = new ScreenText(gd.GD, mFontMats, mFonts[0], 1000);
            mSUI = new ScreenUI(gd.GD, mFontMats, 100);

            mTextProj = Matrix.OrthoOffCenterLH(0, mResX, mResY, 0, 0.1f, 5f);

            //load avail static stuff
            if (Directory.Exists(mGameRootDir + "/Statics"))
            {
                DirectoryInfo di = new DirectoryInfo(mGameRootDir + "/Statics");

                FileInfo[] fi = di.GetFiles("*.MatLib", SearchOption.TopDirectoryOnly);

                if (fi.Length > 0)
                {
                    mStaticMats = new MatLib(gd, mSKeeper);
                    mStaticMats.ReadFromFile(fi[0].DirectoryName + "\\" + fi[0].Name);

                    mStaticMats.InitCelShading(1);
                    mStaticMats.GenerateCelTexturePreset(gd.GD,
                                                         (gd.GD.FeatureLevel == FeatureLevel.Level_9_3),
                                                         false, 0);
                    mStaticMats.SetCelTexture(0);
                    mKeeper.AddLib(mStaticMats);
                }

                mStatics = Mesh.LoadAllStaticMeshes(mGameRootDir + "\\Statics", gd.GD);

                foreach (KeyValuePair <string, IArch> arch in mStatics)
                {
                    arch.Value.UpdateBounds();
                }

                fi = di.GetFiles("*.StaticInstance", SearchOption.TopDirectoryOnly);
                foreach (FileInfo f in fi)
                {
                    string archName = FileUtil.StripExtension(f.Name);
                    if (archName.Contains('_'))
                    {
                        archName = archName.Substring(0, f.Name.IndexOf('_'));
                    }

                    archName += ".Static";

                    if (!mStatics.ContainsKey(archName))
                    {
                        continue;
                    }

                    StaticMesh sm = new StaticMesh(mStatics[archName]);

                    sm.ReadFromFile(f.DirectoryName + "\\" + f.Name);

                    mMeshes.Add(sm);

                    sm.UpdateBounds();
                    sm.SetMatLib(mStaticMats);
                    Vector3 randPos = Mathery.RandomPosition(mRand,
                                                             Vector3.UnitX * 100f +
                                                             Vector3.UnitZ * 100f);
                    mMeshPositions.Add(randPos);
                    mMeshRotations.Add(Vector3.Zero);
                    mMeshScales.Add(Vector3.One);
                    UpdateStaticTransform(mMeshes.Count - 1);
                }
                AddStaticCollision();
            }

            //skip hair stuff when computing bone bounds
            //hits to hair usually wouldn't activate much
            List <string> skipMats = new List <string>();

            skipMats.Add("Hair");

            //load character stuff if any around
            if (Directory.Exists(mGameRootDir + "/Characters"))
            {
                DirectoryInfo di = new DirectoryInfo(mGameRootDir + "/Characters");

                FileInfo[] fi = di.GetFiles("*.AnimLib", SearchOption.TopDirectoryOnly);
                if (fi.Length > 0)
                {
                    mCharAnims = new AnimLib();
                    mCharAnims.ReadFromFile(fi[0].DirectoryName + "\\" + fi[0].Name);

                    List <Anim> anims = mCharAnims.GetAnims();
                    foreach (Anim a in anims)
                    {
                        mAnims.Add(a.Name);
                    }
                }

                fi = di.GetFiles("*.MatLib", SearchOption.TopDirectoryOnly);
                if (fi.Length > 0)
                {
                    mCharMats = new MatLib(mGD, mSKeeper);
                    mCharMats.ReadFromFile(fi[0].DirectoryName + "\\" + fi[0].Name);
                    mCharMats.InitCelShading(1);
                    mCharMats.GenerateCelTexturePreset(gd.GD,
                                                       gd.GD.FeatureLevel == FeatureLevel.Level_9_3, false, 0);
                    mCharMats.SetCelTexture(0);
                    mKeeper.AddLib(mCharMats);
                }

                fi = di.GetFiles("*.Character", SearchOption.TopDirectoryOnly);
                foreach (FileInfo f in fi)
                {
                    IArch arch = new CharacterArch();
                    arch.ReadFromFile(f.DirectoryName + "\\" + f.Name, mGD.GD, true);

                    mCharArchs.Add(FileUtil.StripExtension(f.Name), arch);
                }

                fi = di.GetFiles("*.CharacterInstance", SearchOption.TopDirectoryOnly);
                foreach (FileInfo f in fi)
                {
                    string archName = f.Name;
                    if (archName.Contains('_'))
                    {
                        archName = f.Name.Substring(0, f.Name.IndexOf('_'));
                    }

                    if (!mCharArchs.ContainsKey(archName))
                    {
                        continue;
                    }

                    Character c = new Character(mCharArchs[archName], mCharAnims);

                    //map this to an arch
                    mCharToArch.Add(c, mCharArchs[archName]);

                    c.ReadFromFile(f.DirectoryName + "\\" + f.Name);

                    c.SetMatLib(mCharMats);

                    c.SetTransform(Matrix.Translation(
                                       Mathery.RandomPosition(mRand,
                                                              Vector3.UnitX * 100f +
                                                              Vector3.UnitZ * 100f)));

                    c.ComputeBoneBounds(skipMats);

                    c.AutoInvert(true, mInvertInterval);

                    mCharacters.Add(c);
                }

                if (mCharacters.Count > 0)
                {
                    mAnimTimes = new float[mCharacters.Count];
                    mCurAnims  = new int[mCharacters.Count];
                    mCBone     = new int[mCharacters.Count];
                    mCBones    = new Dictionary <int, Matrix> [mCharacters.Count];
                }

                foreach (KeyValuePair <string, IArch> arch in mCharArchs)
                {
                    //build draw data for bone bounds
                    (arch.Value as CharacterArch).BuildDebugBoundDrawData(mGD.GD, mCPrims);
                }
            }

            //typical material group for characters
            //or at least it works with the ones
            //I have right now
            //TODO: way to define these in the asset?
            List <string> skinMats = new List <string>();

            skinMats.Add("Face");
            skinMats.Add("Skin");
            skinMats.Add("EyeWhite");
            skinMats.Add("EyeLiner");
            skinMats.Add("IrisLeft");
            skinMats.Add("PupilLeft");
            skinMats.Add("IrisRight");
            skinMats.Add("PupilRight");
            skinMats.Add("Nails");
            mKeeper.AddMaterialGroup("SkinGroup", skinMats);

            mTextColor  = Vector4.UnitY + (Vector4.UnitW * 0.15f);
            mHitColor   = Vector4.One * 0.9f;
            mHitColor.Y = mHitColor.Z = 0f;

            mSUI.AddGump("UI\\CrossHair", "CrossHair", Vector4.One,
                         Vector2.UnitX * ((mResX / 2) - 16)
                         + Vector2.UnitY * ((mResY / 2) - 16),
                         Vector2.One);

            //string indicators for various statusy things
            mST.AddString(mFonts[0], "", "StaticStatus",
                          mTextColor, Vector2.UnitX * 20f + Vector2.UnitY * 460f, Vector2.One);
            mST.AddString(mFonts[0], "", "InvertStatus",
                          mTextColor, Vector2.UnitX * 20f + Vector2.UnitY * 480f, Vector2.One);
            mST.AddString(mFonts[0], "", "AnimStatus",
                          mTextColor, Vector2.UnitX * 20f + Vector2.UnitY * 500f, Vector2.One);
            mST.AddString(mFonts[0], "", "CharStatus",
                          mTextColor, Vector2.UnitX * 20f + Vector2.UnitY * 520f, Vector2.One);
            mST.AddString(mFonts[0], "", "PosStatus",
                          mTextColor, Vector2.UnitX * 20f + Vector2.UnitY * 540f, Vector2.One);
            mST.AddString(mFonts[0], "", "HitStatus",
                          mTextColor, Vector2.UnitX * 20f + Vector2.UnitY * 560f, Vector2.One);
            mST.AddString(mFonts[0], "", "ThreadStatus",
                          mTextColor, Vector2.UnitX * 20f + Vector2.UnitY * 580f, Vector2.One);

            UpdateCAStatus();
            UpdateInvertStatus();
            UpdateStaticStatus();
        }
Esempio n. 19
0
 public MainMenuScreen(MatchStartData matchData, FrontEndConstants consts, ScreenUI owner)
     : base(matchData, consts, owner)
 {
 }
Esempio n. 20
0
 public CreditsScreen(ScreenUI owner, MatchStartData msd, FrontEndConstants consts) : base(msd, consts, owner)
 {
 }
Esempio n. 21
0
 // Use this for initialization
 void Start()
 {
     bFading         = false;
     CurrentVelocity = InitialVelocity;
     ScreenUI.SetActive(false);
 }
    public CreateMatchMenuScreen(MatchStartData matchStartData, FrontEndConstants consts, ScreenUI owner)
        : base(matchStartData, consts, owner)
    {
        //Initialize data.

        //Debug.Log("Reading matches:");
        XmlDocument matchDoc = new XmlDocument();

        matchDoc.LoadXml(Owner.MatchesFile.text);
        //matchDoc.LoadXml(Owner.MatchesFile.text.Substring(1, Owner.MatchesFile.text.Length - 1));
        matchSettings = new MatchSettingsReadWrite(matchDoc);
        //Debug.Log("Read matches");

        //Debug.Log("Reading levels:");
        XmlDocument levelsDoc = new XmlDocument();

        levelsDoc.LoadXml(Owner.LevelsFile.text);
        //levelsDoc.LoadXml(Owner.LevelsFile.text.Substring(1, Owner.LevelsFile.text.Length - 1));
        levelGeneration = new LevelGenerationReadWrite(levelsDoc);
        //Debug.Log("Read levels");

        selectedMatch         = "Unreadable";
        selectedLevelGen      = "Unreadable";
        selectedMatchIndex    = 0;
        selectedLevelGenIndex = 0;

        //Read matches.

        if (matchSettings.ErrorMessage == "")
        {
            matches   = new GUIContent[matchSettings.Matches.Count()];
            matchSets = new Rules[matches.Length];
            int count = 0;
            foreach (string rulesN in matchSettings.Matches)
            {
                matchSets[count] = matchSettings.ReadMatch(rulesN);

                if (matchSettings.ErrorMessage != "")
                {
                    matches   = null;
                    matchSets = null;
                    break;
                }

                matches[count] = new GUIContent(rulesN, matchSets[count].Description);
                count         += 1;
            }

            selectedMatchIndex      = Search(Convert(matches, m => m.text), "Brawl", (s1, s2) => s1 == s2);
            selectedMatch           = matches[selectedMatchIndex].text;
            MatchData.MatchSettings = matchSets[selectedMatchIndex];
        }
        else
        {
            matches   = null;
            matchSets = null;
        }

        //Read levels.

        if (levelGeneration.ErrorMessage == "")
        {
            levels    = new GUIContent[levelGeneration.Levels.Count()];
            levelGens = new Generator[levels.Length];
            int count = 0;
            foreach (string levelN in levelGeneration.Levels)
            {
                levelGens[count] = levelGeneration.ReadGenerator(levelN);

                if (levelGeneration.ErrorMessage != "")
                {
                    levels    = null;
                    levelGens = null;
                    break;
                }

                levels[count] = new GUIContent(levelN, levelGens[count].Description);
                count        += 1;
            }

            selectedLevelGenIndex    = Search(Convert(levels, l => l.text), "Corridor", (s1, s2) => s1 == s2);
            selectedLevelGen         = levels[selectedLevelGenIndex].text;
            MatchData.GeneratedLevel = levelGens[selectedLevelGenIndex];
            MatchData.GenerateLevelAndSpawns();
        }
        else
        {
            levels    = null;
            levelGens = null;
        }
    }
Esempio n. 23
0
 private void Awake()
 {
     //Cache
     screenUI = FindObjectOfType <ScreenUI>();
 }
Esempio n. 24
0
 public MenuScreen(MatchStartData matchStartData, FrontEndConstants consts, ScreenUI owner)
 {
     MatchData = matchStartData;
     Consts    = consts;
     Owner     = owner;
 }
 public GenerateLevelMenuScreen(MatchStartData matchStartData, FrontEndConstants consts, ScreenUI owner)
     : base(matchStartData, consts, owner)
 {
     MatchData.GenerateLevelAndSpawns();
     regenerate = true;
 }
 public MatchEndScreen(MatchStartData matchData, FrontEndConstants consts, ScreenUI owner)
     : base(matchData, consts, owner)
 {
     elapsed = 0.0f;
     WorldConstants.MatchController.GetComponent <InputManager>().DisableInput = true;
 }