예제 #1
0
        //Classes below called from XNA base classes.
        //It was made for logical isolation of the game functions from framework methods
        protected void GameInitialize()
        {
            //Loading configuration from file...
            var config = new Configuration(GameSettings.ConfigurationFile);

            //And writing it to static class GameSettings
            GameSettings.Load(config);

            //Initizating managers
            Managers.Add(ScreenManager = new ScreenManager());
            Managers.Add(ControlsManager = new ControlsManager());
            Managers.Add(GraphicsManager = new GraphicsManager(Graphics, GraphicsDevice, Window));
            Managers.Add(MenuManager = new MenuManager());
            Managers.Add(WorldManager = new WorldManager());
        }
예제 #2
0
        //Loading configuration from file
        public static void Load(Configuration config)
        {
            WorldWidth = config.GetInt("World", "WorldWidth", 120);
            WorldHeight = config.GetInt("World", "WorldHeight", 120);
            Borders = new Rectangle(-WorldWidth * TileHeight / 2, -WorldHeight * TileHeight / 2,
            WorldWidth * TileHeight, WorldHeight * TileHeight);

            InitCreatures = config.GetInt("World", "InitCreatures", 30);
            InitFood = config.GetInt("World", "InitFood", 300);
            CrateCount = config.GetInt("World", "CrateCount", 20);
            CrateSizeMin = config.GetInt("World", "CrateSizeMin", 10)/10f;
            CrateSizeMax = config.GetInt("World", "CrateSizeMax", 30)/10f;

            CreatureSizeMin = config.GetInt("Creature", "SizeMin", 10)/10f;
            CreatureSizeMax = config.GetInt("Creature", "SizeMax", 20)/10f;
            CreatureChildrenMin = config.GetInt("Creature", "ChildrenMin", 1);
            CreatureChildrenMax = config.GetInt("Creature", "ChildrenMax", 4);
            CreatureLootCount = config.GetInt("Creature", "LootCount", 4);
            CreatureMovingSpeed = config.GetFloat("Creature", "MovingSpeed", 12f);
            CreatureRotatingSpeed = config.GetFloat("Creature", "RotatingSpeed", 3f);
            CreatureBreedingEnergy = config.GetFloat("Creature", "BreedingEnergy", 100f);
            CreatureBreedingTimer = config.GetFloat("Creature", "BreedingTimer", 0.01f);
            CreatureAttackDamage = config.GetFloat("Creature", "AttackDamage", 25f);
            CreatureHungerDamage = config.GetFloat("Creature", "HungerDamage", 5f);
            CreatureHungerDamageInterval = config.GetInt("Creature", "HungerDamageInterval", 80);
            CreatureLookRange = config.GetFloat("Creature", "LookRange", 8f);
            CreatureSniffRange = config.GetFloat("Creature", "SniffRange", 4f);
            FoodSatiety = config.GetFloat("Creature", "FoodSatiety", 12.5f);

            NetworkInitMinValue = config.GetFloat("Network", "InitMinValue", 0.015f);
            NetworkInitMaxValue = config.GetFloat("Network", "InitMaxValue", 0.05f);
            NetworkLearningRate = config.GetFloat("Network", "LearningRate", 0.01f);
            NetworkRandomSpread = config.GetFloat("Network", "RandomSpread", 0.01f);
            NetworkSensorsAmplifier = config.GetFloat("Network", "SensorsAmplifier", 1f);
            NetworkThreshold = config.GetFloat("Network", "Threshold", 0.45f);
            NetworkDamageLearningRateAmplifier = config.GetFloat("Network", "DamageLearningRateAmplifier", 2f);
        }