public void Start()
        {
            DatabaseId = ArgumentStore.IdToLoad ?? DatabaseId;

            DbHandler = new EvolutionDatabaseHandler();

            EvolutionConfig = DbHandler.ReadConfig(DatabaseId);

            DbHandler.SetAutoloadId(DatabaseId);

            if (EvolutionConfig == null || EvolutionConfig.DatabaseId != DatabaseId)
            {
                throw new Exception("Did not retrieve expected config from database");
            }

            _matchControl = gameObject.GetComponent <EvolutionMatchController>();
            if (_matchControl == null)
            {
                _matchControl = gameObject.AddComponent <EvolutionMatchController>();
            }

            _mutationControl.Config = EvolutionConfig.MutationConfig;
            _matchControl.Config    = EvolutionConfig.MatchConfig;
            ShipConfig.Config       = EvolutionConfig.MatchConfig;

            ReadInGeneration();

            SpawnRaceGoal();

            SpawnShips();

            SpawnDrones();
        }
    public void SetCurrentGeneration_UpdatesCurrentGeneration()
    {
        var config = _handler.ReadConfig(3);

        Assert.AreEqual(3, config.DatabaseId);

        _handler.SetCurrentGenerationNumber(3, 5);

        var config2 = _handler.ReadConfig(3);

        Assert.AreEqual(5, config2.GenerationNumber);  //has been read back out

        //repeat with a different number, to be sure it wasn't just 5 to begin with.
        _handler.SetCurrentGenerationNumber(3, 7);

        var config3 = _handler.ReadConfig(3);

        Assert.AreEqual(7, config3.GenerationNumber);  //has been read back out
    }
Пример #3
0
        private void LoadConfigFromDB()
        {
            _hasLoadedExisting = ArgumentStore.IdToLoad.HasValue;
            _loadedId          = ArgumentStore.IdToLoad ?? -1;

            var config = _hasLoadedExisting ? _handler.ReadConfig(_loadedId) : new EvolutionConfig();

            GeneralConfig.PopulateControls(config);
            MatchConfig.PopulateControls(config);
            MutationConfig.PopulateControls(config);
            BrConfig.PopulateControls(config);
            DroneConfig.PopulateControls(config);
            RaceConfig.PopulateControls(config);
        }
Пример #4
0
    public void SetCurrentGeneration_UpdatesCurrentGeneration()
    {
        var config = _handler.ReadConfig(1);

        Assert.AreEqual(1, config.DatabaseId);

        _handler.SetCurrentGenerationNumber(1, 5);

        config.GenerationNumber = 2;  //set it werong
        var config1 = _handler.ReadConfig(1);

        Assert.AreEqual(5, config1.GenerationNumber);  //has been read back out

        //repeat with a different number, to be sure it wasn't just 5 to begin with.
        _handler.SetCurrentGenerationNumber(1, 7);

        config.GenerationNumber = 3;  //set it werong
        var config2 = _handler.ReadConfig(1);

        Assert.AreEqual(7, config2.GenerationNumber);  //has been read back out
    }
Пример #5
0
    public void ReadConfig_ReadsID()
    {
        var config = _handler.ReadConfig(2);

        Assert.AreEqual(2, config.DatabaseId);
    }