Exemple #1
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth  = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;

            graphics.IsFullScreen = fullscreen;

            screenRectangle = new Rectangle(0, 0, screenWidth, screenHeight);

            Content.RootDirectory = "Content";

            Sounds.loadSounds(Content);

            Components.Add(new InputHandler(this));

            stateManager = new GameStateManager(this);
            Components.Add(stateManager);

            titleScreen = new TitleScreen(this, stateManager);
            playScreen  = new PlayScreen(this, stateManager);
            levelSelect = new LevelSelect(this, stateManager);

            stateManager.ChangeState(titleScreen);
        }
 public void Initialize(LevelSelect parent, int levelIndex)
 {
     _parent     = parent;
     _levelIndex = levelIndex;
     SetIndex(levelIndex);
     GetComponent <Button>().onClick.AddListener(PlayLevel);
 }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        // get player reference
        player = GameObject.FindGameObjectWithTag("player").GetComponent <PlayerScript>();
        // get generator component
        generator = GetComponent <ObstacleGenerator>();        // assumes the component is on this gameobject
        // get wheel reference
        wheel = GameObject.FindGameObjectWithTag("Roller").GetComponent <BigRoller>();
        // get level select ref
        levelSelect = GetComponent <LevelSelect>();
        // get UI ref
        UI = GetComponent <GameplayUI>();
        // get actual player angle
        player.posOnWheel = Vector3.Angle(Vector3.up, player.transform.position - wheel.transform.position);

        currentLifeStage = 0;

        stressDistance = maxDistance;

        AudioController = GameObject.Find("Global").GetComponent <AudioControl>();

        // Audio test stuff
        //bassTrack.clip = Bass;
        //melodyTrack.clip = Melody;
    }
Exemple #4
0
        private void playAgainBtn_Click(object sender, EventArgs e)
        {
            LevelSelect nextForm = new LevelSelect();

            this.Close();
            nextForm.Show();
        }
Exemple #5
0
 // Use this for initialization
 void Start()
 {
     selector = LevelOrchestrator.GetComponent <LevelSelect>();
     selector.OnLevelChanged += LevelChanged;
     rb           = GetComponent <Rigidbody>();
     lastVelocity = rb.velocity.magnitude;
 }
    private void OnMouseDown()
    {
        LevelSelect level = Instantiate(levelSelect).GetComponent <LevelSelect>();

        level.setPlayButton(this);
        gameObject.SetActive(false);
    }
 public void OnCancel()
 {
     if (!_goingBack)
     {
         LevelSelect.LoadLevel(BuildIndex.CHARACTER_SELECT);
     }
 }
Exemple #8
0
    // Update is called once per frame
    void Update()
    {
        if (x3 == null)
        {
            x3 = new Xbox360Controller(ID);
        }

        if (SignedIn)
        {
            float hor = x3.HorizontalAxis();
            float ver = x3.VerticalAxis();
            this.transform.position += new Vector3(hor, -ver) * speed;
        }
        else
        {
            if (x3.StartPressed())
            {
                SignedIn = true;
                this.GetComponent <SpriteRenderer> ().enabled            = true;
                select.transform.GetChild(1).GetComponent <Text> ().text = "";
                select.color = desired;
                SignedInCount++;
                AudioSource.PlayClipAtPoint(GameObject.FindObjectOfType <NetworkingObjectMenu>().click, GameObject.FindGameObjectWithTag("MainCamera").transform.position);
            }
        }

        if (collidingLevel != null)
        {
            if (x3.PressedJump())
            {
                LevelType level = collidingLevel.lt;
                GlobalProperties.LEVEL = level.ToString();
                collidingLevel.GetComponent <SpriteRenderer>().color = Color.red;
                AudioSource.PlayClipAtPoint(collidingLevel.noise, GameObject.FindGameObjectWithTag("MainCamera").transform.position);

                if (prevCollidingLevel == null || prevCollidingLevel == collidingLevel)
                {
                    prevCollidingLevel = collidingLevel;
                }
                else
                {
                    prevCollidingLevel.GetComponent <SpriteRenderer>().color = Color.white;
                    prevCollidingLevel = collidingLevel;
                }
            }
        }
        else if (colliding != null)
        {
            if (x3.PressedJump())
            {
                CharacterType character = colliding.ct;
                GlobalProperties.PLAYERCHOICE[ID - 1] = character.ToString();
                select.transform.GetChild(2).GetComponent <Image>().sprite    = GameObject.FindObjectOfType <CharacterDictionary>().GetByText(character.ToString());
                select.transform.GetChild(1).GetComponent <Text> ().text      = "\n" + character.ToString();
                select.transform.GetChild(1).GetComponent <Text> ().alignment = TextAnchor.UpperRight;
                AudioSource.PlayClipAtPoint(colliding.noise, GameObject.FindGameObjectWithTag("MainCamera").transform.position);
            }
        }
    }
Exemple #9
0
        private void playAgainBtn_Click(object sender, EventArgs e)
        {
            // Go back to game start and difficulty selection
            LevelSelect nextForm = new LevelSelect();

            this.Close();
            nextForm.Show();
        }
Exemple #10
0
 public MainMenu()
 {
     Instance    = this;
     Active      = true;
     titleScene  = new TitleScene();
     howto       = new HowToPlay();
     levelSelect = new LevelSelect();
 }
Exemple #11
0
        /// <summary>
        /// Load Game Assets and initialize all screens
        /// </summary>
        protected override void LoadContent()
        {
            //Instantiate the singleton class GameContent and load all game assets
            GameContent gameContent = new GameContent(Content);

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //Instantiate the singleton class HorizontalMenuBGSprite
            HorizontalMenuBGSprite scrollingBG = new HorizontalMenuBGSprite(GameContent.GameAssets.Images.Backgrounds.Screens[ScreenBackgrounds.GlobalScrollingBg], spriteBatch);


            //Initialize screens

            titleScreen = new Title(spriteBatch, new Delegates.QuitFunction(Exit));
            titleScreen.InitScreen(ScreenType.Title);
            titleScreen.Visible = true;

            shopScreen = new Shop(spriteBatch);
            shopScreen.InitScreen(ScreenType.Shop);

            controlScreen = new ControlScreen(spriteBatch);
            controlScreen.InitScreen(ScreenType.ControlScreen);

            mainMenuScreen = new MainMenu(spriteBatch);
            mainMenuScreen.InitScreen(ScreenType.MainMenu);

            creditsScreen = new Credits(spriteBatch);
            creditsScreen.InitScreen(ScreenType.Credits);

            gameScreen = new GameScreen(spriteBatch);
            gameScreen.InitScreen(ScreenType.Game);

            optionScreen = new Options(spriteBatch);
            optionScreen.InitScreen(ScreenType.Options);

            pauseScreen = new PauseScreen(spriteBatch);
            pauseScreen.InitScreen(ScreenType.Pause);

            shipSelectScreen = new ShipSelect(spriteBatch);
            shipSelectScreen.InitScreen(ScreenType.ShipSelect);

            weaponSelectScreen = new WeaponSelectScreen(spriteBatch);
            weaponSelectScreen.InitScreen(ScreenType.WeaponSelect);

            upgradeScreen = new UpgradeScreen(spriteBatch);
            upgradeScreen.InitScreen(ScreenType.UpgradeScreen);

            tierSelectScreen = new TierSelect(spriteBatch);
            tierSelectScreen.InitScreen(ScreenType.TierSelect);

            levelSelectScreen = new LevelSelect(spriteBatch);
            levelSelectScreen.InitScreen(ScreenType.LevelSelect);

            screenManager            = new ScreenManager(spriteBatch, Color.White, titleScreen, mainMenuScreen, creditsScreen, gameScreen, optionScreen, shopScreen, pauseScreen, shipSelectScreen, weaponSelectScreen, upgradeScreen, tierSelectScreen, levelSelectScreen, controlScreen);
            StateManager.AllScreens  = screenManager;
            StateManager.ScreenState = CoreTypes.ScreenType.Title;
        }
    // Use this for initialization
    void Start()
    {
        star1 = gameObject.transform.Find("TopPanel").Find("Star1").gameObject;
        star2 = gameObject.transform.Find("TopPanel").Find("Star2").gameObject;
        star3 = gameObject.transform.Find("BottomPanel").Find("Star3").gameObject;
        star4 = gameObject.transform.Find("BottomPanel").Find("Star4").gameObject;
        star5 = gameObject.transform.Find("BottomPanel").Find("Star5").gameObject;

        LevelSelect levelSelectScript = levelManager.GetComponent <LevelSelect>();

        int targetScore = 0;
        int highScore   = 0;

        if (level == 1)
        {
            targetScore = levelSelectScript.easyScore * levelSelectScript.easyCusts;
            highScore   = SaveLoad.getEasyHiScore();
        }
        if (level == 2)
        {
            targetScore = levelSelectScript.normalScore * levelSelectScript.normalCusts;
            highScore   = SaveLoad.getMediumHiScore();
        }
        if (level == 3)
        {
            targetScore = levelSelectScript.hardScore * levelSelectScript.hardCusts;
            highScore   = SaveLoad.getHardHiScore();
        }


        float starsToFill = ((float)highScore / (float)targetScore) * 5.0f;

        if (starsToFill >= 1.0f)
        {
            star1.GetComponent <Image>().sprite = fullStar;
            starsToFill -= 1.0f;
        }
        if (starsToFill >= 1.0f)
        {
            star2.GetComponent <Image>().sprite = fullStar;
            starsToFill -= 1.0f;
        }
        if (starsToFill >= 1.0f)
        {
            star3.GetComponent <Image>().sprite = fullStar;
            starsToFill -= 1.0f;
        }
        if (starsToFill >= 1.0f)
        {
            star4.GetComponent <Image>().sprite = fullStar;
            starsToFill -= 1.0f;
        }
        if (starsToFill >= 1.0f)
        {
            star5.GetComponent <Image>().sprite = fullStar;
            starsToFill -= 1.0f;
        }
    }
Exemple #13
0
    public void OnMouseDown()
    {
        // Loads the level in the "levelName" string.

        LevelSelect transScript = selected.GetComponent <LevelSelect>();

        transScript.levelID = levelName;
        FindObjectOfType <LevelSelect>().LevelSelected();
    }
Exemple #14
0
 public void Initialize(LevelData levelData, LevelSelect levelSelect, int level)
 {
     this.levelSelect = levelSelect;
     title.text       = levelData.name;
     image.sprite     = levelData.image;
     description.text = levelData.description;
     this.level       = level;
     goal.text        = "Goal: " + levelData.gridData.goalCommutes + " daily commutes";
 }
 public void RouteInputBack()
 {
     if (!_goingBack)
     {
         sfxManager.PlayMenuBackSound();
         gameData.SetSkipToMode(true);
         LevelSelect.LoadMainMenu();
     }
 }
 // Use this for initialization
 void Start()
 {
     LevelSelect.initLevels();
     Time.timeScale = 1;
     if (Application.loadedLevelName == "_Start_Screen")
     {
         InitStartScreenOptions();
     }
 }
 public void LoadLevel()
 {
     if (loadLevelBuildIndex == BuildIndex.CHARACTER_SELECT)
     {
         LevelSelect.LoadLevel(loadLevelBuildIndex);
         return;
     }
     LevelSelect.LoadLevel(BuildIndex.CONTROLLER_MAP);
 }
Exemple #18
0
    void Start()
    {
        levelSelect = GetComponent <LevelSelect>();

        for (int i = 0; i < MAX_SCORE; i++)
        {
            scoreTransforms.Add(scorePanel.GetChild(i).GetComponent <Animator>());
            scoreEndAnimators.Add(scoreEndPanel.transform.GetChild(i).GetComponent <Animator>());
        }
    }
Exemple #19
0
 public void LaunchClassicMode()
 {
     if (_blockInput)
     {
         return;
     }
     gameData.SetGameMode(EMode.Soccer);
     gameData.SetGameLevel(BuildIndex.LEVEL_SELECT);
     LevelSelect.LoadCharacterSelect();
 }
Exemple #20
0
    public void onStartClicked()
    {
        GameObject  gObj     = GameObject.Find("levelID");
        LevelSelect levelSel = gObj.GetComponent(typeof(LevelSelect)) as LevelSelect;

        Application.LoadLevelAdditive(levelSel.levels[levelSel.levelSelected]);

        hideAllScreens();
        ed_levelPreviewScreen.SetActive(false);
    }
Exemple #21
0
 public void LaunchDeathmatchMode()
 {
     if (_blockInput)
     {
         return;
     }
     gameData.SetGameMode(EMode.Deathmatch);
     gameData.SetGameLevel(BuildIndex.LEVEL_SELECT);
     LevelSelect.LoadCharacterSelect();
 }
Exemple #22
0
 void OnTriggerEnter2D(Collider2D c)
 {
     if (c.gameObject.GetComponent <CharacterSelect>() != null)
     {
         colliding = c.gameObject.GetComponent <CharacterSelect>();
     }
     if (c.gameObject.GetComponent <LevelSelect>() != null)
     {
         collidingLevel = c.gameObject.GetComponent <LevelSelect>();
     }
 }
 // open level at index
 public void openLevel(int idx)
 {
     if (!isOpenLevel)
     {
         GameManager.instance.makeButtonPressSound();
         isOpenLevel   = true;
         currOpenLevel = levels[idx];
         filter.gameObject.SetActive(true);
         currOpenLevel.gameObject.SetActive(true);
     }
 }
Exemple #24
0
 void Awake()
 {
     GameObject.DontDestroyOnLoad(Camera.main);
     GameObject.DontDestroyOnLoad(
         GameObject.FindGameObjectWithTag("Light"));
     waveInfo      = GetComponent <WaveInfo>();
     levelSelect   = GetComponent <LevelSelect>();
     increaseStats = GetComponent <IncreaseStats>();
     loadingScreen = GetComponent <LoadingScreen>();
     Application.LoadLevel("levelSelect");
 }
 // close the curently open level
 public void closeCurr()
 {
     if (isOpenLevel)
     {
         GameManager.instance.makeButtonPressSound();
         isOpenLevel = false;
         currOpenLevel.gameObject.SetActive(false);
         filter.gameObject.SetActive(false);
         currOpenLevel = null;
     }
 }
	void Start() {

		pauseMenu = this.GetComponent<PauseMenu> ();
		pauseMenu.enabled = false;

		settingsMenu = this.GetComponent<SettingsMenu> ();
		settingsMenu.enabled = false;

		levelSelect = this.GetComponent<LevelSelect> ();
		levelSelect.enabled = false;
	}
Exemple #27
0
 void Start()
 {
     if (AskUseBrainWave)
     {
         UI_BrainWave_dir(true);
     }
     else
     {
         LevelSelect.SetActive(true);
     }
 }
Exemple #28
0
 private void Awake()
 {
     mystage = GameControl.control.Stage;
     if (lSelect == null)
     {
         DontDestroyOnLoad(gameObject);
         lSelect = this;
     }
     else if (lSelect != this)
     {
         Destroy(gameObject);
     }
 }
Exemple #29
0
    public void HandleStart()
    {
        G4.LogEvent("PressButton", "StartButton", "HasPressed", 1);

        // Builder Hit with all Event parameters.
        G4.LogEvent(new EventHitBuilder()
                    .SetEventCategory("PressButton")
                    .SetEventAction("StartButton")
                    .SetEventLabel("HasPressed")
                    .SetEventValue(1));

        Debug.Log("Sent");
        LevelSelect.SetActive(true);
        StartMenu.SetActive(false);
    }
Exemple #30
0
    public void cfgLoadLevels()
    {
        ConfigReader cfgFile = new ConfigReader();

        cfgFile.Load(configPath);

        GameObject  gObj     = GameObject.FindGameObjectWithTag("LevelID");
        LevelSelect levelSel = gObj.GetComponent(typeof(LevelSelect)) as LevelSelect;

        Xml.XmlNodeList mapNode = cfgFile.GetElementsByTagName("Map");
        levelSel.pathToLevels = cfgFile.DocumentElement.FirstChild.Attributes[0].Value;


        int mapCount = mapNode.Count;

        levelSel.levels = new string[mapCount];
        int itn = 0;

        foreach (Xml.XmlElement nodes in mapNode)
        {
            levelSel.levels[itn] = nodes.InnerText;
            itn = itn + 1;
        }


        string[] levelsPath = new string[levelSel.levels.Length];

#if UNITY_EDITOR
/*
 *              EditorBuildSettingsScene[] newSettings = new EditorBuildSettingsScene[levelSel.levels.Length];
 *
 *              for (int i = 0; i < levelsPath.Length; i++) {
 *                      levelsPath[i] = levelSel.pathToLevels+"/"+levelSel.levels[i]+".unity";
 *                      EditorBuildSettingsScene sceneL = new EditorBuildSettingsScene(levelsPath[i],true);
 *                      newSettings[i]=sceneL;
 *              }
 *
 *              EditorBuildSettings.scenes = newSettings;
 */
#endif

        for (int i = 0; i < levelsPath.Length; i++)
        {
            levelsPath[i] = levelSel.pathToLevels + "/" + levelSel.levels[i] + ".unity";
        }
    }
    protected override IEnumerator DisplayLoadingScreen(int SceneNumber)
    {
        //隱藏選擇關卡
        LevelSelect.SetActive(false);
        //顯示Loading畫面
        Loading.SetActive(true);

        yield return(new WaitForSeconds(0.5f));

        AsyncOperation LoadScene = SceneManager.LoadSceneAsync(SceneNumber);

        //載入完後先不跳轉Scene
        LoadScene.allowSceneActivation = false;

        float Progress = 0;

        float displayProgress = 0;

        while (LoadScene.progress < 0.9f)
        {
            Progress = LoadScene.progress;
            while (displayProgress < Progress)
            {
                displayProgress += 0.01f;
                yield return(waitforendOfframe);
            }
        }

        Progress = 1f;

        while (displayProgress < Progress)
        {
            displayProgress += 0.01f;
            yield return(waitforendOfframe);
        }

        yield return(new WaitForSeconds(0.4f));

//		Resources.UnloadUnusedAssets ();//讓Unity 自行去卸載掉不使用的資源

        //跳轉Scene
        LoadScene.allowSceneActivation = true;
    }
    // Use this for initialization
    void Start()
    {
        // get player reference
        player = GameObject.FindGameObjectWithTag("player").GetComponent<PlayerScript>();
        // get generator component
        generator = GetComponent<ObstacleGenerator>(); // assumes the component is on this gameobject
        // get wheel reference
        wheel = GameObject.FindGameObjectWithTag("Roller").GetComponent<BigRoller>();
        // get level select ref
        levelSelect = GetComponent<LevelSelect>();
        // get UI ref
        UI = GetComponent<GameplayUI>();
        // get actual player angle
        player.posOnWheel = Vector3.Angle(Vector3.up, player.transform.position - wheel.transform.position);

        currentLifeStage = 0;

        stressDistance = maxDistance;

        AudioController = GameObject.Find("Global").GetComponent<AudioControl>();

        // Audio test stuff
        //bassTrack.clip = Bass;
        //melodyTrack.clip = Melody;
    }
        public static void loadSavedData()
        {
            if (GlobalSave.SaveDevice.FileExists(GlobalSave.containerName, GlobalSave.fileName_rampage_scores))
            {
                GlobalSave.SaveDevice.Load(
                    GlobalSave.containerName,
                    GlobalSave.fileName_rampage_scores,
                    stream =>
                    {
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            for (int i = 0; i < 6; i++)
                            {
                                RampageScores.Insert(i, float.Parse(reader.ReadLine()));
                            }
                        }
                    });
            }

            if (GlobalSave.SaveDevice.FileExists(GlobalSave.containerName, GlobalSave.fileName_rampagetimed_scores))
            {
                GlobalSave.SaveDevice.Load(
                    GlobalSave.containerName,
                    GlobalSave.fileName_rampagetimed_scores,
                    stream =>
                    {
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            for (int i = 0; i < 6; i++)
                            {
                                RampageTimedScores.Insert(i, float.Parse(reader.ReadLine()));
                            }
                        }
                    });
            }

            if (GlobalSave.SaveDevice.FileExists(GlobalSave.containerName, GlobalSave.fileName_alterego_scores))
            {
                GlobalSave.SaveDevice.Load(
                    GlobalSave.containerName,
                    GlobalSave.fileName_alterego_scores,
                    stream =>
                    {
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            for (int i = 0; i < 6; i++)
                            {
                                AlterEgoScores.Insert(i, float.Parse(reader.ReadLine()));
                            }
                        }
                    });
            }

            if (GlobalSave.SaveDevice.FileExists(GlobalSave.containerName, GlobalSave.fileName_alteregotimed_scores))
            {
                GlobalSave.SaveDevice.Load(
                    GlobalSave.containerName,
                    GlobalSave.fileName_alteregotimed_scores,
                    stream =>
                    {
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            for (int i = 0; i < 6; i++)
                            {
                                AlterEgoTimedScores.Insert(i, float.Parse(reader.ReadLine()));
                            }
                        }
                    });
            }

            if (GlobalSave.SaveDevice.FileExists(GlobalSave.containerName, GlobalSave.fileName_timebandit_scores))
            {
                GlobalSave.SaveDevice.Load(
                    GlobalSave.containerName,
                    GlobalSave.fileName_timebandit_scores,
                    stream =>
                    {
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            for (int i = 0; i < 6; i++)
                            {
                                TimeBanditScores.Insert(i, float.Parse(reader.ReadLine()));
                            }
                        }
                    });
            }

            if (GlobalSave.SaveDevice.FileExists(GlobalSave.containerName, GlobalSave.fileName_extermination_scores))
            {
                GlobalSave.SaveDevice.Load(
                    GlobalSave.containerName,
                    GlobalSave.fileName_extermination_scores,
                    stream =>
                    {
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            for (int i = 0; i < 6; i++)
                            {
                                ExterminationScores.Insert(i, float.Parse(reader.ReadLine()));
                            }
                        }
                    });
            }

            RampageScores.Sort();
            RampageScores.Reverse();
            RampageTimedScores.Sort();
            RampageTimedScores.Reverse();
            AlterEgoScores.Sort();
            AlterEgoScores.Reverse();
            AlterEgoTimedScores.Sort();
            AlterEgoTimedScores.Reverse();
            TimeBanditScores.Sort();
            TimeBanditScores.Reverse();
            ExterminationScores.Sort();
            ExterminationScores.Reverse();

            if (GlobalSave.SaveDevice.FileExists(GlobalSave.containerName, GlobalSave.fileName_options))
            {
                GlobalSave.SaveDevice.Load(
                    GlobalSave.containerName,
                    GlobalSave.fileName_options,
                    stream =>
                    {
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            Vibrate = bool.Parse(reader.ReadLine());
                            MusicOn = bool.Parse(reader.ReadLine());
                            SoundFXOn = bool.Parse(reader.ReadLine());
                            ControlOption = int.Parse(reader.ReadLine());
                            ThumbsticksOn = bool.Parse(reader.ReadLine());
                        }
                    });
            }

            if (GlobalSave.SaveDevice.FileExists(GlobalSave.containerName, GlobalSave.fileName_autofire))
            {
                GlobalSave.SaveDevice.Load(
                    GlobalSave.containerName,
                    GlobalSave.fileName_autofire,
                    stream =>
                    {
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            AIControlled = bool.Parse(reader.ReadLine());
                        }
                    });
            }

            if (GlobalSave.SaveDevice.FileExists(GlobalSave.containerName, GlobalSave.fileName_level))
            {
                GlobalSave.SaveDevice.Load(
                    GlobalSave.containerName,
                    GlobalSave.fileName_level,
                    stream =>
                    {
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            level = int.Parse(reader.ReadLine());
                        }
                    });
            }

            Config.Level = (LevelSelect)level + 1;

            if (GlobalSave.SaveDevice.FileExists(GlobalSave.containerName, GlobalSave.fileName_ships))
            {
                GlobalSave.SaveDevice.Load(
                    GlobalSave.containerName,
                    GlobalSave.fileName_ships,
                    stream =>
                    {
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            ship2Locked = bool.Parse(reader.ReadLine());
                            ship3Locked = bool.Parse(reader.ReadLine());

                            ship1Active = bool.Parse(reader.ReadLine());
                            ship2Active = bool.Parse(reader.ReadLine());
                            ship3Active = bool.Parse(reader.ReadLine());
                        }
                    });
            }

            if (GlobalSave.SaveDevice.FileExists(GlobalSave.containerName, GlobalSave.fileName_coins))
            {
                GlobalSave.SaveDevice.Load(
                    GlobalSave.containerName,
                    GlobalSave.fileName_coins,
                    stream =>
                    {
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            Config.Coins = double.Parse(reader.ReadLine());
                        }
                    });
            }

            if (Config.ship1Active)
            {
                Config.CurrentProjectile = Config.BulletSheetGreenLaser;
                Config.CurrentShipTop = Config.Ship1SpriteSheet;
                Config.CurrentShipBase = Config.Ship1SpriteSheetBase;
                Config.CurrentShipColor = Config.Ship1Color;
            }

            if (Config.ship2Active)
            {
                Config.CurrentProjectile = Config.BulletSheetShip2Laser;
                Config.CurrentShipTop = Config.Ship2SpriteSheet;
                Config.CurrentShipBase = Config.Ship2SpriteSheetBase;
                Config.CurrentShipColor = Config.Ship2Color;
            }

            if (Config.ship3Active)
            {
                Config.CurrentProjectile = Config.BulletSheetShip3Laser;
                Config.CurrentShipTop = Config.Ship3SpriteSheet;
                Config.CurrentShipBase = Config.Ship3SpriteSheetBase;
                Config.CurrentShipColor = Config.Ship3Color;
            }

            if (GlobalSave.SaveDevice.FileExists(GlobalSave.containerName, GlobalSave.fileName_upgrades))
            {
                GlobalSave.SaveDevice.Load(
                    GlobalSave.containerName,
                    GlobalSave.fileName_upgrades,
                    stream =>
                    {
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            Config.activeUpgrades = int.Parse(reader.ReadLine());

                            Config.bHealth5Locked = bool.Parse(reader.ReadLine());
                            Config.bHealth10Locked = bool.Parse(reader.ReadLine());
                            Config.bHealth15Locked = bool.Parse(reader.ReadLine());
                            Config.bShields10Locked = bool.Parse(reader.ReadLine());
                            Config.bShields20Locked = bool.Parse(reader.ReadLine());
                            Config.bShields30Locked = bool.Parse(reader.ReadLine());
                            Config.bDamage1Locked = bool.Parse(reader.ReadLine());
                            Config.bDamage2Locked = bool.Parse(reader.ReadLine());
                            Config.bDamage4Locked = bool.Parse(reader.ReadLine());
                            Config.bRange10Locked = bool.Parse(reader.ReadLine());
                            Config.bRange20Locked = bool.Parse(reader.ReadLine());
                            Config.bRange50Locked = bool.Parse(reader.ReadLine());
                            Config.bPowerup5Locked = bool.Parse(reader.ReadLine());
                            Config.bPowerup10Locked = bool.Parse(reader.ReadLine());
                            Config.bPowerup20Locked = bool.Parse(reader.ReadLine());

                            Config.bHealth5Active = bool.Parse(reader.ReadLine());
                            Config.bHealth10Active = bool.Parse(reader.ReadLine());
                            Config.bHealth15Active = bool.Parse(reader.ReadLine());
                            Config.bShields10Active = bool.Parse(reader.ReadLine());
                            Config.bShields20Active = bool.Parse(reader.ReadLine());
                            Config.bShields30Active = bool.Parse(reader.ReadLine());
                            Config.bDamage1Active = bool.Parse(reader.ReadLine());
                            Config.bDamage2Active = bool.Parse(reader.ReadLine());
                            Config.bDamage4Active = bool.Parse(reader.ReadLine());
                            Config.bRange10Active = bool.Parse(reader.ReadLine());
                            Config.bRange20Active = bool.Parse(reader.ReadLine());
                            Config.bRange50Active = bool.Parse(reader.ReadLine());
                            Config.bPowerup5Active = bool.Parse(reader.ReadLine());
                            Config.bPowerup10Active = bool.Parse(reader.ReadLine());
                            Config.bPowerup20Active = bool.Parse(reader.ReadLine());
                        }
                    });
            }


            if (Config.bPowerup5Active)
                Config.PowerupDropChance += 5;
            if (Config.bPowerup10Active)
                Config.PowerupDropChance += 10;
            if (Config.bPowerup20Active)
                Config.PowerupDropChance += 20;

            if (Config.bHealth5Active)
                Config.ShipHealth += 5;
            if (Config.bHealth10Active)
                Config.ShipHealth += 10;
            if (Config.bHealth15Active)
                Config.ShipHealth += 15;

            if (Config.bShields10Active)
                Config.ShieldHealth += 10;
            if (Config.bShields20Active)
                Config.ShieldHealth += 20;
            if (Config.bShields30Active)
                Config.ShieldHealth += 30;

            if (Config.bRange10Active)
                Config.ProjectileRange += 10;
            if (Config.bRange20Active)
                Config.ProjectileRange += 20;
            if (Config.bRange50Active)
                Config.ProjectileRange += 50;

            if (Config.bDamage1Active)
            {
                Config.PlayerBulletDamage += 1;
                Config.MissileDamage += 1;
            }
            if (Config.bDamage2Active)
            {
                Config.PlayerBulletDamage += 2;
                Config.MissileDamage += 2;
            }
            if (Config.bDamage4Active)
            {
                Config.PlayerBulletDamage += 4;
                Config.MissileDamage += 4;
            }

        }
 // Use this for initialization
 void Start()
 {
     instance = this;
 }
 void Start()
 {
     m_LvlSel = GameObject.Find("LevelSelectMenu").GetComponent<LevelSelect>();
 }
Exemple #36
0
 // Use this for initialization
 void Start()
 {
     attributes = GameObject.Find("Player").GetComponent<PlayerAttributes> ();
     killAllMonstersInGame = false;
     killAllMonstersOnLevel = false;
     reachTheStars = false;
     deadEnemies = 0;
     deadEnemiesOnLevel = 0;
     levelSelect = this.GetComponent<LevelSelect> ();
 }