public static Game StartGame(Guid accountId, Guid gameId, string word, DifficultySetting level)
        {
            var game = new Game();

            game.Record(new GameStarted(accountId.ToString(), gameId.ToString(), word, (int)level), gameId.ToString());
            return(game);
        }
 public StartGame(Guid gameId, Guid accountId, string word, DifficultySetting level)
 {
     this.gameId    = gameId;
     this.accountId = accountId;
     this.word      = word;
     this.level     = level;
 }
Example #3
0
 public void setDifficultySettings(DifficultySetting difficulty)
 {
     if (difficulty == DifficultyBioMass)
     {
         return;
     }
 }
        public void OnClickHigherDifficulty()
        {
            if (SavingNew)
            {
                return;
            }

            Debug.Log("OnClickHigherrDifficulty");

            mSuspendUpdates = true;

            for (int i = 0; i < AvailableDifficulties.Count; i++)
            {
                if (CurrentDifficultySetting.Name == AvailableDifficulties[i].Name)
                {
                    CurrentDifficultySetting = AvailableDifficulties.NextItem(i);
                    break;
                }
                else
                {
                    Debug.Log("Doesn't match " + AvailableDifficulties[i].Name);
                }
            }

            Profile.Get.SetDifficulty(CurrentDifficultySetting);
            mSuspendUpdates = false;
            ReceiveFromParentEditor(FetchItems());
            ResetInputs();
        }
Example #5
0
        /// <summary>
        /// Create Custom Settings
        /// </summary>
        /// <returns>Custom setting object</returns>
        public DifficultySetting CreateCustomDifficulty()
        {
            var diffSetting = new DifficultySetting(0.75m, 0.55m, 3);

            diffSetting.AddDifficultyItem(new DifficultyItem("Reduced Damage", "reducedDamage", false, true, "Reduced Damage\n\nDecreases damage dealt to the player and members of his group."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Group Indicators", "groupIndicators", true, true, "Group Indicators\n\nShows indication icons on units in player's group."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Friendly Name Tags", "friendlyTags", true, true, "Friendly Name Tags\n\nFriendly unit identification. Works only when the player aims at a unit."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Enemy Name Tags", "enemyTags", true, true, "Enemy Name Tags\n\nEnemy unit identification. Works only when the player aims at a unit."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Detected Mines", "detectedMines", true, true, "Detected Mines\n\nShows icons indicating exact positions of mines. show = display the indicators on mines at 200m and closer."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Commands", "commands", true, true, "Commands\n\nDisplays command icons like target markers, get in command and others."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Waypoints", "waypoints", true, true, "Commands\n\nManages visibility of waypoint markers."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Weapon Info", "weaponInfo", true, true, "Commands\n\nShows Weapon Info box (contains round and magazine count, firing mode, etc.)."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Stance Indicator", "stanceIndicator", true, true, "Stance Indicator\n\nDisplays stance indication (contains actual stance, weapon resting and deployment)."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Stamina Bar", "staminaBar", true, true, "Stamina Bar\n\nManages visibility of stamina indicator. true = fades in when stamina changes."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Crosshair", "weaponCrosshair", true, true, "Crosshair\n\nShows weapon crosshair both in 1st and 3rd person view."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Vision Aid", "visionAid", true, true, "Vision Aid\n\nHelps to detect units in visual range and identify friend from foe."));
            diffSetting.AddDifficultyItem(new DifficultyItem("3rd Person View", "thirdPersonView", true, true, "3rd Person View\n\nEnables camera switching to 3rd person view."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Camera Shake", "cameraShake", true, true, "Camera Shake\n\nShakes camera if player is near explosion, passing vehicle or if player's vehicle is under G-load."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Score Table", "scoreTable", true, true, "Score Table\n\n	Displays table with kills, deaths and overall score in multiplayer."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Killed By", "deathMessages", true, true, "Killed By\n\nShows in chat window who killed the player."));
            diffSetting.AddDifficultyItem(new DifficultyItem("VON ID", "vonID", true, true, "VON ID\n\nIndicates who is speaking through VON communication."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Extended Map Content", "mapContent", true, true, "Extended Map Content\n\nShows friendly units, enemy units and detected mines on the map."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Automatic Reporting", "autoReport", true, true, "Automatic Reporting\n\nEnables automatic reporting of various situations by the player."));
            diffSetting.AddDifficultyItem(new DifficultyItem("Multiple Saves", "multipleSaves", true, true, "Multiple Saves\n\nAllows player to create multiple saves in a mission."));

            return(diffSetting);
        }
        private void changeSettings(DifficultySetting diff, bool initialSet)
        {
            if (diff == BioMassDifficulty)
            {
                return;
            }

            this.Log_DebugOnly("Change Difficulty FROM " + BioMassDifficulty.ToString() + " TO " + diff);
            ClassicSettings = false;
            EasySettings    = false;
            NormalSettings  = false;
            HardSettings    = false;

            BioMassDifficulty = diff;

            switch (BioMassDifficulty)
            {
            case DifficultySetting.Classic:
                ClassicSettings = true;
                thePath         = IOUtils.GetFilePathFor(this.GetType(), "Classic.txt");
                this.Log(thePath);
                theDirectoryPath = System.IO.Path.GetDirectoryName(thePath);
                System.IO.File.Copy(thePath, System.IO.Path.Combine(theDirectoryPath, "BioMassDifficulty_MM.cfg"), true);
                break;

            case DifficultySetting.Easy:
                EasySettings = true;
                thePath      = IOUtils.GetFilePathFor(this.GetType(), "Easy.txt");
                this.Log(thePath);
                theDirectoryPath = System.IO.Path.GetDirectoryName(thePath);
                System.IO.File.Copy(thePath, System.IO.Path.Combine(theDirectoryPath, "BioMassDifficulty_MM.cfg"), true);
                break;

            case DifficultySetting.Normal:
                NormalSettings = true;
                thePath        = IOUtils.GetFilePathFor(this.GetType(), "Moderate.txt");
                this.Log(thePath);
                theDirectoryPath = System.IO.Path.GetDirectoryName(thePath);
                System.IO.File.Copy(thePath, System.IO.Path.Combine(theDirectoryPath, "BioMassDifficulty_MM.cfg"), true);
                break;

            case DifficultySetting.Hard:
                HardSettings = true;
                thePath      = IOUtils.GetFilePathFor(this.GetType(), "Hard.txt");
                this.Log(thePath);
                theDirectoryPath = System.IO.Path.GetDirectoryName(thePath);
                System.IO.File.Copy(thePath, System.IO.Path.Combine(theDirectoryPath, "BioMassDifficulty_MM.cfg"), true);
                break;

            default:
                break;
            }

            if (!initialSet)
            {
                globalSettings.setDifficultySettings(BioMassDifficulty);
            }
        }
Example #7
0
    void Start()
    {
        instance          = GetComponent <BoardManager>();
        difficultySetting = FindObjectOfType <DifficultySetting>();

        Vector2 offset = tile.GetComponent <SpriteRenderer>().bounds.size;

        CreateBoard(offset.x, offset.y);
    }
Example #8
0
 public PlayerGame()
 {
     Character              = new PlayerCharacter();
     Difficulty             = new DifficultySetting();
     MarkedLocations        = new List <MobileReference> ();
     NewLocations           = new List <MobileReference> ();
     RevealedLocations      = new List <MobileReference> ();
     LocationTypesToDisplay = new List <string> ();
 }
Example #9
0
 private void LoadFromNode(ConfigNode node)
 {
     if (node.HasNode(configNodeName))
     {
         ConfigNode settingsNode = node.GetNode(configNodeName);
         DifficultyBioMass = Utilities.GetValue(settingsNode, "DifficultySettings", DifficultyBioMass);
         this.LogWarning("Difficulty read " + DifficultyBioMass.ToString());
     }
 }
        public void OnClickCancelCreateNewSetting( )
        {
            //get rid of the one we were saving
            //assume we have more than 0 (safe bet)
            CurrentDifficultySetting = AvailableDifficulties[0];

            SavingNew = false;

            ResetInputs();
        }
Example #11
0
        public int[,] GenerateSudokuBoardWithDifficultySetting(int[,] board, DifficultySetting difficultySetting)
        {
            var updatedBoard = board;

            //setup the board info
            boardInfo = CommonMethods.GetSudokuBoardSize(board);

            //setup each difficulty situation that is required
            foreach (var difficultySituation in difficultySetting.DifficultySituations)
            {
                updatedBoard = AddDifficultySitiuationToBoard(updatedBoard, difficultySituation);
            }
            return(updatedBoard);
        }
Example #12
0
        public void LoadDifficultySettings()
        {
            DifficultySettings.Clear();
            List <string> difficultySettingNames = Mods.Get.ModDataNames("DifficultySetting");

            foreach (string difficultySettingName in difficultySettingNames)
            {
                DifficultySetting setting = null;
                if (Mods.Get.Editor.LoadMod <DifficultySetting>(ref setting, "DifficultySetting", difficultySettingName))
                {
                    DifficultySettings.Add(setting);
                }
            }
        }
    public static Noeud[] GenerateDifficulty(DifficultySetting difficultySetting, Noeud[] graph)
    {
        List <float> listOfDifficulty = GenerateListNumberDificulty(difficultySetting, graph);

        for (int i = 0; i < listOfDifficulty.Count; i++)
        {
            graph[i].dangerosityValue = listOfDifficulty[i];
            graph[i].dangerosity      = randomStat(
                difficultySetting.courbeEasy.Evaluate(listOfDifficulty[i]),
                difficultySetting.courbeIntermediate.Evaluate(listOfDifficulty[i]),
                difficultySetting.courbeDificult.Evaluate(listOfDifficulty[i]));
        }

        return(graph);
    }
 public static Noeud[] GenerateDungeon(DifficultySetting difficultySetting, Vector2 roomSize, Noeud[] graph, GameObject[] roomsPrefabs, Transform parent)
 {
     graph = GenerateDifficultyTool.GenerateDifficulty(difficultySetting, graph);
     foreach (GameObject go in roomsPrefabs)
     {
         go.GetComponent <RoomSettings>().Initialisation();
     }
     graph = FindRooms(roomsPrefabs, graph);
     foreach (Noeud node in graph)
     {
         node.sallePrefab = UnityEngine.Object.Instantiate(node.sallePrefab, (Vector2)node.position * roomSize - roomSize / 2, Quaternion.identity, parent);
         node.sallePrefab.GetComponent <Room>().position = node.position;
     }
     graph = PlaceDoor(graph);
     return(graph);
 }
Example #15
0
        public Settings()
        {
            this.Log_DebugOnly("Constructor Settings");

            //string filepath = IOUtils.GetFilePathFor(this.GetType(), "XYZ");
            //PathKSP = GetKSPPath(filepath);
            PathPlugin = string.Format("{0}",AddonName);
            PathPluginData = string.Format("{0}/PluginData", PathPlugin);
            PathTextures = string.Format("{0}/Textures", PathPlugin);
            GlobalConfigFile = IOUtils.GetFilePathFor(this.GetType(), "BioMass.cfg");

            this.Log_DebugOnly("ConfigFile: " + GlobalConfigFile);

            this.globalSettingsNode = new ConfigNode();

            DifficultyBioMass = DifficultySetting.Normal;
        }
Example #16
0
        public bool SetDifficulty(DifficultySetting setting)
        {
            if (!HasCurrentProfile)
            {
                Debug.Log("Couldn't set difficulty, had no profile");
                return(false);
            }

            if (CurrentGame == null)
            {
                mCurrentGame = new PlayerGame();
            }

            CurrentGame.DifficultyName = setting.Name;
            CurrentGame.Difficulty     = setting;
            return(true);
        }
Example #17
0
        public Settings()
        {
            this.Log_DebugOnly("Constructor Settings");

            //string filepath = IOUtils.GetFilePathFor(this.GetType(), "XYZ");
            //PathKSP = GetKSPPath(filepath);
            PathPlugin       = string.Format("{0}", AddonName);
            PathPluginData   = string.Format("{0}/PluginData", PathPlugin);
            PathTextures     = string.Format("{0}/Textures", PathPlugin);
            GlobalConfigFile = IOUtils.GetFilePathFor(this.GetType(), "BioMass.cfg");

            this.Log_DebugOnly("ConfigFile: " + GlobalConfigFile);

            this.globalSettingsNode = new ConfigNode();

            DifficultyBioMass = DifficultySetting.Normal;
        }
Example #18
0
        private DifficultyConfig GetDifficultyConfigForSetting(DifficultySetting difficultySetting)
        {
            switch (difficultySetting)
            {
            case DifficultySetting.Easy:
                return(easyConfig);

            case DifficultySetting.Medium:
                return(mediumConfig);

            case DifficultySetting.Hard:
                return(hardConfig);

            default:
                return(mediumConfig);
            }
        }
        public void OnClickCreateNewSetting()
        {
            mSuspendUpdates = true;

            CurrentDifficultySetting = ObjectClone.Clone <DifficultySetting>(CurrentDifficultySetting);
            CurrentDifficultySetting.HasBeenCustomized = true;
            CurrentDifficultySetting.Name     = "New Setting";
            CustomSettingNameInput.text       = CurrentDifficultySetting.Name;
            CustomSettingNameInput.label.text = CustomSettingNameInput.text;
            UICamera.selectedObject           = CustomSettingNameInput.gameObject;
            UIInput.current = CustomSettingNameInput;

            SavingNew = true;

            mSuspendUpdates = false;

            ResetInputs();
        }
Example #20
0
        public Settings()
        {
            this.Log_DebugOnly("Constructor Settings");

            //string filepath = IOUtils.GetFilePathFor(this.GetType(), "XYZ");
            //PathKSP = GetKSPPath(filepath);
            PathPlugin = string.Format("{0}",AddonName);
            PathPluginData = string.Format("{0}/PluginData", PathPlugin);
            PathTextures = string.Format("{0}/Textures", PathPlugin);
            GlobalConfigFile = IOUtils.GetFilePathFor(this.GetType(), "BioMass.cfg");

            this.Log_DebugOnly("ConfigFile: " + GlobalConfigFile);

            this.globalSettingsNode = new ConfigNode();

            MaxDeltaTime = SECONDS_PER_DAY; // max 1 day (24 hour) per physics update, or 50 days (4,320,000 seconds) per second
            ElectricityMaxDeltaTime = 1; // max 1 second per physics update

            Food = "Food";
            Water = "Water";
            Oxygen = "Oxygen";
            CO2 = "CarbonDioxide";
            Waste = "Waste";
            WasteWater = "WasteWater";
            Seeds = "Seeds";
            BioMass = "BioMass";
            Light = "Light";
            BioCake = "BioCake";
            CompressedCO2 = "CompressedCO2";
            Hydrogen = "Hydrogen";

            WasteWaterConsumptionRate = 0.00000826f;
            WaterConsumptionRate = 0.00000826f;
            OxygenConsumptionRate = 0.00000445;
            CO2ConsumptionRate = 0.00002018f;

            CO2ProductionRate = 0.00000612f;
            OxygenProductionRate = 0.00001468f;
            WaterProductionRate = 0.00000250f;
            DifficultyBioMass = DifficultySetting.Normal;
        }
Example #21
0
    public void SetDifficultyLevel(int chosenSetting)
    {
        if (chosenSetting == 1)
        {
            currentDifficultyLevel = DifficultySetting.Easy;
        }
        if (chosenSetting == 2)
        {
            currentDifficultyLevel = DifficultySetting.Normal;
        }
        if (chosenSetting == 3)
        {
            currentDifficultyLevel = DifficultySetting.Hard;
        }

        if (currentDifficultyLevel == DifficultySetting.Easy)
        {
            goalWeek                = 3;
            goalDiamondQuantity     = 6;
            TotalNumberOfDeliveries = 3;
        }
        else if (currentDifficultyLevel == DifficultySetting.Normal)
        {
            goalWeek                = 5;
            goalDiamondQuantity     = 16;
            TotalNumberOfDeliveries = 5;
            sell4DiamondsButton.SetActive(true);
        }
        else if (currentDifficultyLevel == DifficultySetting.Hard)
        {
            goalWeek                = 6;
            goalDiamondQuantity     = 32;
            TotalNumberOfDeliveries = 5;
            sell4DiamondsButton.SetActive(true);
            sell5DiamondsButton.SetActive(true);
        }

        StartCoroutine(FixStartingGoalDisplayed());
    }
    private static List <float> GenerateListNumberDificulty(DifficultySetting difficultySetting, Noeud[] graph)
    {
        //CRITICAL PATH LENGTH
        int          criticalPathLength = 0;
        List <float> listOfDifficulty   = new List <float>();

        for (int i = 0; graph[i].type != Noeud.TYPE_DE_NOEUD.END; i++)
        {
            criticalPathLength++;
        }
        criticalPathLength++;

        //CRITICAL PATH DANGEROSITY
        float dangerosityTotal = 0;
        float dangerosityStep  = 1f / criticalPathLength;

        for (int i = 0; i < criticalPathLength; i++)
        {
            listOfDifficulty.Add(difficultySetting.courbeDeDifficulte.Evaluate(dangerosityTotal));
            dangerosityTotal += dangerosityStep;
        }

        //SECONDARY PATH DANGEROSITY
        for (int i = criticalPathLength; i < graph.Length; i++)
        {
            foreach (int key in graph[i].liens.Keys)
            {
                if (key < i)
                {
                    listOfDifficulty.Add(listOfDifficulty[key]);
                    break;
                }
            }
        }

        return(listOfDifficulty);
    }
Example #23
0
        /// <summary>
        /// Insert images into the Grid
        /// </summary>
        /// <param name="grid"></param>
        /// <returns></returns>
        public static Grid InsertGridImages(Grid grid, Image[] images, DifficultySetting difficultySetting)
        {
            grid.Children.Clear();

            int imagecount = 0;

            for (int row = 0; row < difficultySetting.GridRowSize; row++)
            {
                for (int column = 0; column < difficultySetting.GridColumnSize; column++)
                {
                    Image image = new Image
                    {
                        Source = images[imagecount].Source,
                        Aspect = Aspect.AspectFit,
                        Margin = new Thickness(2)
                    };

                    grid.Children.Add(image, row, column);

                    imagecount += 1;
                }
            }
            return(grid);
        }
Example #24
0
    public void SaveValues()
    {
        GameManager game = GameManager.instance;
        EnemyManager enemyManager = EnemyManager.instance;
        OnGuiManager onGuiManager = OnGuiManager.instance;
        SmoothMouseLookX mouseX = SmoothMouseLookX.instance;
        SmoothMouseLookY mouseY = SmoothMouseLookY.instance;
        TriggerHandler dragonTriggerHandler = TriggerHandler.instance;

        dragonSlayed = game.statistics.dragonSlayed;

        // save GameObject, Transform, Vector3 and Quaternion by adding .Serializable() extension
        sPlayer = game.player.gameObject.Serializable();
        sTreasure = game.treasure.gameObject.Serializable();
        if (dragonSlayed){
            GameObject dragonRagdoll = GameObject.Find("Dragon Ragdoll(Clone)");
            sDragon = dragonRagdoll.Serializable();
        } else {
            sDragon = game.dragon.gameObject.Serializable();
        }

        // save enemies and misc objects by listing them
        sGameObjects = new List<sGameObject>();
        foreach (GameObject go in GameObject.FindObjectsOfType(typeof(GameObject)) as GameObject[]){
            if (go.name.Equals("orc(Clone)") || go.name.Equals("orc ragdoll(Clone)") ||
                go.name.Equals("Lizard(Clone)") || go.name.Equals("Lizard ragdoll(Clone)") ||
                go.name.Equals("WereWolf(Clone)") || go.name.Equals("WereWolf ragdoll(Clone)")){
                sGameObjects.Add(go.Serializable());
            }
        }

        // save current time and date
        dateTime = System.DateTime.Now.ToString("MM/dd/yyyy, HH:mm");

        // save playtime with previous value + time since level load
        playTime = game.statistics.playTime + Time.timeSinceLevelLoad;

        // save time variables relative to Time.timeSinceLevelLoad as load game's time starts from 0
        timeOfLastWave = enemyManager.timeOfLastWave - Time.timeSinceLevelLoad;
        timeOfEnemyCountRising = enemyManager.timeOfEnemyCountRising - Time.timeSinceLevelLoad;
        spawnTimeStart = enemyManager.spawnTimeStart - Time.timeSinceLevelLoad;

        // save game difficulty setting
        difficulty = game.difficulty;

        formatVersion = game.saves.GetFormatVersion();

        // save regular variable here
        timeBetweenEnemyCountAddition = enemyManager.timeBetweenEnemyCountAddition;
        waveIntervalOnDragonFight = enemyManager.waveIntervalOnDragonFight;
        maxDragonFightEnemies = enemyManager.maxDragonFightEnemies;
        dragonFightSpwans = enemyManager.dragonFightSpwans;
        waveInterval = enemyManager.waveInterval;
        maxEnemies = enemyManager.maxEnemies;
        originalWaveInterval = enemyManager.originalWaveInterval;
        originalMaxEnemies = enemyManager.originalMaxEnemies;
        inBattle = enemyManager.inBattle;
        spawnCount = enemyManager.spawnCount;
        nextEnemyType = enemyManager.nextEnemyType;
        dragonHasAggroOnPlayer = dragonTriggerHandler.dragonHasAggroOnPlayer;
        playerKilledTrigger = dragonTriggerHandler.playerKilled;
        mousePositionX = mouseX.GetPosition();
        mousePositionY = mouseY.GetPosition();
        //mouseSensitivity = mouseX.sensitivity;
        //mouseSmoothing = mouseX.smoothing;
        level = game.statistics.level;
        bodycount = game.statistics.bodycount;
        score = game.statistics.score;
        pickupState = game.pickupState;
        bloodAlpha = onGuiManager.bloodSplatter.GetBloodAlpha();
        playerArmor = game.player.GetArmor();
        playerHealth = game.player.GetHealth();
        playerAlive = game.player.GetAliveStatus();
        treasureOnGround = game.treasure.OnGround();
        treasureAmount = game.treasure.GetTreasureAmount();
        wave = game.statistics.wave;
        gun0_rounds = game.weapons.guns[0].currentRounds;
        gun1_rounds = game.weapons.guns[1].currentRounds;
        gun2_rounds = game.weapons.guns[2].currentRounds;
        gun3_rounds = game.weapons.guns[3].currentRounds;
        gun4_rounds = game.weapons.guns[4].currentRounds;
        gun0_clips = game.weapons.guns[0].totalClips;
        gun1_clips = game.weapons.guns[1].totalClips;
        gun2_clips = game.weapons.guns[2].totalClips;
        gun3_clips = game.weapons.guns[3].totalClips;
        gun4_clips = game.weapons.guns[4].totalClips;
        pickedup_gun3 = game.weapons.guns[3].picked_up;
        pickedup_gun4 = game.weapons.guns[4].picked_up;
        pickedup_armor = game.statistics.armorPickedUp;
        grenades = game.weapons.grenadeCount;
        currentGunIndex = game.weapons.currentGunIndex;
        dragonFighting = game.dragon.GetFighting();
        dragonPatroling = game.dragon.GetPatroling();
        dragonWalking = game.dragon.GetWalking();
        dragonLanding = game.dragon.GetLanding();
        dragonHealth = game.dragon.GetHealth();
        dragonMaxHealth = game.dragon.GetMaxHealth();
        dragonBreathFire = game.dragon.breathFire;
        dragonLastBreath = game.dragon.timeOfLastFireBreath;
        dragonFlying = game.dragon.flying;
    }
Example #25
0
 void OnLevelWasLoaded(int level)
 {
     if (saves == null){
         GetSaveManager();
     }
     switch (level){
     case 0: // main menu
         if (saves.levelState == LevelState.LOADING_HIGHSCORE){
             difficulty = saves.difficulty;
             gameState = GameState.HIGHSCORE;
         }
         saves.levelState = LevelState.LOADED;
         break;
     default:
         if (saves.levelState == LevelState.LOADING_SAVE){
             saves.container.RestoreValues();
             saves.levelState = LevelState.LOADED;
         } else {
             NewGame();
         }
         break;
     }
 }
Example #26
0
 private void LoadFromNode(ConfigNode node)
 {
     if (node.HasNode(configNodeName))
     {
         ConfigNode settingsNode = node.GetNode(configNodeName);
         DifficultyBioMass = Utilities.GetValue(settingsNode, "DifficultySettings",DifficultyBioMass);
         this.LogWarning("Difficulty read "+DifficultyBioMass.ToString());
     }
 }
Example #27
0
 public void setDifficultySettings(DifficultySetting difficulty)
 {
     if (difficulty == DifficultyBioMass)
     {
         return;
     }
 }
Example #28
0
        /// <summary>
        /// This functions loads the content for the level.
        /// </summary>
        /// <param name="fileStream">stream used to load level from text file</param>
        /// <param name="difficulty">difficulty setting to create level in</param>
        /// <param name="gameplayTextures">gameplay textures (i.e. background/tiles)</param>
        /// <param name="playerTextures">player animation textures</param>
        /// <param name="playerSounds"> player sound effects</param>
        /// <param name="enemyTextures">enemy animation textures</param>
        public void LoadContent(
            Stream fileStream, 
            int difficulty, 
            Texture2D[] gameplayTextures,
            Texture2D[] playerTextures,
            SoundEffect[] playerSounds,
            Texture2D[] enemyTextures)
        {
            switch (difficulty) //difficulty state switch
            {
                case 0: this.difficulty = DifficultySetting.Easy;
                    easy = new Easy();
                    this.winScore = easy.winScore;
                    this.textureLimit = easy.textureLimit;
                    break;

                case 1: this.difficulty = DifficultySetting.Medium;
                    medium = new Medium();
                    this.winScore = medium.winScore;
                    this.textureLimit = medium.textureLimit;
                    break;

                case 2: this.difficulty = DifficultySetting.Hard;
                    hard = new Hard();
                    this.winScore = hard.winScore;
                    this.textureLimit = hard.textureLimit;
                    break;
            }

            timeCount = TimeSpan.FromMinutes(0.0); //set start time of game to zero

            this.backgroundTexture = gameplayTextures[0]; //load background texture

            //load the tile textures
            this.platformTexture = gameplayTextures[1];
            this.floorATexture = gameplayTextures[2];
            this.floorBTexture = gameplayTextures[3];
            this.floorEdgeLTexture = gameplayTextures[4];
            this.floorEdgeRTexture = gameplayTextures[5];
            LoadTiles(fileStream); //load the tile map

            //create new player object
            playerStart = new Vector2(60, 448); //define start position
            player = new Player(this, playerStart);
            player.LoadContent(playerTextures, playerSounds);

            //create new enemy list (i.e. room for multiple enemies)
            enemies = new List<Enemy>();
            enemySpawn = 0;
            enemyType = new String[3] { "Body", "Robe", "Armour" };
            enemyIndex = 0;
            this.enemyTextures = enemyTextures;
            walkLeft = false;
            enemyKilled = playerSounds[2];
            LoadEnemy(); //load an initial enemy
        }
Example #29
0
    private void SetDifficulty()
    {
        DifficultySetting difficulty = difficultySettings[currentDifficulty];

        switch (SceneManager.GetActiveScene().name)
        {
        case "WarScene":
            FindObjectOfType <WarScene>().CollectableLifeSeconds = difficulty.CollectableLifeSeconds;
            BombEmitter bombEmitter = FindObjectOfType <BombEmitter>();
            bombEmitter.BombIntervalSeconds = difficulty.BombInterval;
            bombEmitter.BombDrag            = difficulty.BombDrag;
            foreach (BombScript bomb in FindObjectsOfType <BombScript>())
            {
                bomb.GetComponent <Rigidbody2D>().drag = difficulty.BombDrag;
            }
            break;

        case "SeaScene":
            SeaScene sea = FindObjectOfType <SeaScene>();
            sea.StartingWaveStrength = difficulty.StartingWaveSize;
            sea.EndingWaveStrength   = difficulty.EndingWaveSize;
            LandScene.FindObjectsOfTypeAll <EnemyGun>()[0].ShootDelay = difficulty.ShootDelay;
            break;

        case "LandScene":
            Searchlight light = LandScene.FindObjectsOfTypeAll <Searchlight>()[0];    //Find it even if it is disabled
            light.SweepSpeed           = difficulty.SearchlightSpeed;
            light.FramesVisibleForLoss = difficulty.SearchlightTime;
            GuardScript guard = LandScene.FindObjectsOfTypeAll <GuardScript>()[0];
            guard.FramesVisibleForLoss = difficulty.GuardTime;
            guard.WalkSpeed            = difficulty.GuardSpeed;
            LandScene.FindObjectsOfTypeAll <FenceCut>()[0].CutSpeed = difficulty.CutFenceSpeed;
            break;

        default:
            Debug.Log("Can't change difficulty in this scene");
            break;
        }

        ShowText();
        DiffText.color = DifficultyTextColours[currentDifficulty];
        switch (currentDifficulty)
        {
        case 0:
            DiffText.text = "E";
            break;

        case 1:
            DiffText.text = "N";
            break;

        case 2:
            DiffText.text = "H";
            break;

        case 3:
            DiffText.text = "EX";
            break;

        default:
            Debug.LogError("...What just happened?");
            break;
        }
    }
Example #30
0
        public void setDifficultySettings(DifficultySetting difficulty)
        {
            if (difficulty == DifficultyBioMass)
            {
                return;
            }

            DifficultyBioMass = difficulty;
            switch (difficulty)
            {
                case DifficultySetting.Easy:
                    WasteWaterConsumptionRate = 0.00000826f;
                    WaterConsumptionRate = 0.00000826f;
                    OxygenConsumptionRate = 0.00000445;
                    CO2ConsumptionRate = 0.00002018f;

                    CO2ProductionRate = 0.00001612f;
                    OxygenProductionRate = 0.00002468f;
                    WaterProductionRate = 0.00001250f;
                    break;
                case DifficultySetting.Normal:
                    WasteWaterConsumptionRate = 0.00000826f;
                    WaterConsumptionRate = 0.00000826f;
                    OxygenConsumptionRate = 0.00000445;
                    CO2ConsumptionRate = 0.00002018f;

                    CO2ProductionRate = 0.00000612f;
                    OxygenProductionRate = 0.00001468f;
                    WaterProductionRate = 0.00000250f;
                    break;
                case DifficultySetting.Hard:
                    WasteWaterConsumptionRate = 0.00000526f;
                    WaterConsumptionRate = 0.00001326f;
                    OxygenConsumptionRate = 0.00000945;
                    CO2ConsumptionRate = 0.00004018f;

                    CO2ProductionRate = 0.00000912f;
                    OxygenProductionRate = 0.00000868f;
                    WaterProductionRate = 0.00000150f;
                    break;
                case DifficultySetting.Custom:
                    WasteWaterConsumptionRate = 0.00000826f;
                    WaterConsumptionRate = 0.00000826f;
                    OxygenConsumptionRate = 0.00000445;
                    CO2ConsumptionRate = 0.00002018f;

                    CO2ProductionRate = 0.00000612f;
                    OxygenProductionRate = 0.00001468f;
                    WaterProductionRate = 0.00000250f;
                    break;
                default:
                    break;
            }
        }
Example #31
0
 public void NewGame()
 {
     // wait until all gameobjects are loaded
     gameState = GameState.RUNNING;
     statistics.Reset();
     OnGuiManager.instance.bloodSplatter.SetBloodAlpha(0f);
     difficulty = saves.difficulty;
     //set initial health for safe vale, will be corrected on difficulty settings
     ApplyDifficultySetting();
 }
        public override void WakeUp()
        {
            base.WakeUp();

            Mods.Get.Runtime.LoadAvailableMods(AvailableDifficulties, "DifficultySetting");

            CurrentDifficultySetting = null;

            for (int i = 0; i < AvailableDifficulties.Count; i++)
            {
                if (AvailableDifficulties[i].Name == Globals.DefaultDifficultyName)
                {
                    CurrentDifficultySetting = AvailableDifficulties[i];
                    break;
                }
            }

            if (CurrentDifficultySetting == null)
            {
                CurrentDifficultySetting = AvailableDifficulties[0];
            }

            mSuspendUpdates = true;

            ControllingTabPage.OnSelected   += Show;
            ControllingTabPage.OnDeselected += Hide;

            CreateNewSettingButton.functionName = "OnClickCreateNewSetting";
            CreateNewSettingButton.target       = gameObject;
            CancelCreateNewButton.functionName  = "OnClickCancelCreateNewSetting";
            CancelCreateNewButton.target        = gameObject;

            PrevDeathSetting.functionName = "OnClickPrevDeathSetting";
            PrevDeathSetting.target       = gameObject;
            NextDeathSetting.functionName = "OnClickNextDeathSetting";
            NextDeathSetting.target       = gameObject;

            PrevFallDamageSetting.functionName = "OnClickPrevFallDamageSetting";
            PrevFallDamageSetting.target       = gameObject;
            NextFallDamageSetting.functionName = "OnClickNextFallDamageSetting";
            NextFallDamageSetting.target       = gameObject;

            BooleanInput.functionName      = "OnChangeBooleanInput";
            BooleanInput.eventReceiver     = gameObject;
            DecimalInput.functionName      = "OnChangeDecimalInputText";
            DecimalInput.functionNameEnter = "OnChangeDecimalInput";
            DecimalInput.eventReceiver     = gameObject;
            IntegerInput.functionName      = "OnChangeIntegerInputText";
            IntegerInput.functionNameEnter = "OnChangeIntegerInput";
            IntegerInput.eventReceiver     = gameObject;

            CustomSettingNameInput.functionName      = "OnChangeCustomSettingNameText";
            CustomSettingNameInput.functionNameEnter = "OnChangeCustomSettingName";
            CustomSettingNameInput.eventReceiver     = gameObject;

            HigherDifficultyButton.target       = gameObject;
            HigherDifficultyButton.functionName = "OnClickHigherDifficulty";
            LowerDifficulyButton.target         = gameObject;
            LowerDifficulyButton.functionName   = "OnClickLowerDifficulty";

            SaveCustomSettingsButton.target       = gameObject;
            SaveCustomSettingsButton.functionName = "OnClickSaveCustomSettings";

            ApplyChangesButton.target       = gameObject;
            ApplyChangesButton.functionName = "OnClickApplySettingButton";

            RemoveSettingButton.target       = gameObject;
            RemoveSettingButton.functionName = "OnClickRemoveSettingButton";

            foreach (UICheckbox checkbox in TagCheckboxes)
            {
                checkbox.functionName  = "OnChangeTag";
                checkbox.eventReceiver = gameObject;
            }

            mSuspendUpdates = false;
        }
Example #33
0
        private void LoadFromNode(ConfigNode node)
        {
            if (node.HasNode(configNodeName))
            {
                ConfigNode settingsNode = node.GetNode(configNodeName);

                MaxDeltaTime = Utilities.GetValue(settingsNode, "MaxDeltaTime", MaxDeltaTime);
                ElectricityMaxDeltaTime = Utilities.GetValue(settingsNode, "ElectricityMaxDeltaTime", ElectricityMaxDeltaTime);

                Food = Utilities.GetValue(settingsNode, "FoodResource", Food);
                Water = Utilities.GetValue(settingsNode, "WaterRes4600urce", Water);
                Oxygen = Utilities.GetValue(settingsNode, "OxygenResource", Oxygen);
                CO2 = Utilities.GetValue(settingsNode, "CarbonDioxideResource", CO2);
                Waste = Utilities.GetValue(settingsNode, "WasteResource", Waste);
                WasteWater = Utilities.GetValue(settingsNode, "WasteWaterResource", WasteWater);

                Seeds = Utilities.GetValue(settingsNode, "SeedsResource", Seeds);
                BioMass = Utilities.GetValue(settingsNode, "BioMassResource", BioMass);
                Light = Utilities.GetValue(settingsNode, "LightResource", Light);
                BioCake = Utilities.GetValue(settingsNode, "BioCakeResource", BioCake);
                CompressedCO2 = Utilities.GetValue(settingsNode, "CompressedCO2Resource", CompressedCO2);
                Hydrogen = Utilities.GetValue(settingsNode, "HydrogenResource", Hydrogen);

                WasteWaterConsumptionRate = Utilities.GetValue(settingsNode, "WasteWaterConsumptionRate", WasteWaterConsumptionRate) / MaxDeltaTime;
                WaterConsumptionRate = Utilities.GetValue(settingsNode, "WaterConsumptionRate", WaterConsumptionRate) / MaxDeltaTime;
                OxygenConsumptionRate = Utilities.GetValue(settingsNode, "OxygenConsumptionRate", OxygenConsumptionRate) / MaxDeltaTime;
                CO2ConsumptionRate = Utilities.GetValue(settingsNode, "CO2ConsumptionRate", CO2ConsumptionRate) / MaxDeltaTime;

                CO2ProductionRate = Utilities.GetValue(settingsNode, "CO2ProductionRate", CO2ProductionRate) / MaxDeltaTime;
                OxygenProductionRate = Utilities.GetValue(settingsNode, "OxygenProductionRate", OxygenProductionRate) / MaxDeltaTime;
                WaterProductionRate = Utilities.GetValue(settingsNode, "WaterProductionRate", WaterProductionRate) / MaxDeltaTime;
                DifficultyBioMass = Utilities.GetValue(settingsNode, "DifficultySettings",DifficultyBioMass);
                this.LogWarning("Difficulty read "+DifficultyBioMass.ToString());
            }
        }