public GridModel <HexModel> Generate(PlanetModel planetModel) { _resistanceConfig = GameConfig.Get <BellCurveConfig>(); _planetModel = planetModel; GameObject go = GameObject.Find("Map"); HexMap hexMap = go.GetComponent <HexMap>(); _map = new GridModel <HexModel>(hexMap.width.Value, hexMap.height.Value); _elements = GameConfig.Get <ElementConfig>().ElementsList; _elementsDict = GameConfig.Get <ElementConfig>().ElementsDictionary; _elementsProbabilities = new List <WeightedValue>(); _hexScoreUpdateCommand = GameModel.Get <HexScoreUpdateCommand>(); _hexUpdateCommand = GameModel.Get <HexUpdateCommand>(); for (int i = 0; i < _elements.Count; i++) { _elementsProbabilities.Add(new WeightedValue(_elements[i].Index, _elements[i].Rarity)); } Vector2 defaultRange = new Vector2(float.MaxValue, float.MinValue); for (int i = 0; i < 7; i++) { Ranges[i] = defaultRange; } GenerateMap(hexMap); return(_map); }
// Use this for initialization void Start() { _unitDefenseCommand = GameModel.Get <UnitDefenseUpdateCommand>(); _planetUpdateCommand = GameModel.Get <PlanetPropsUpdateCommand>(); _hexScoreUpdateCommand = GameModel.Get <HexScoreUpdateCommand>(); _mineSkill = GameModel.Get <MineSkill>(); _liveSkill = GameModel.Get <LiveSkill>(); _clock = GameModel.Get <Clock>(); _debug = GameModel.Get <GameDebug>(); GameModel.HandleGet <PlanetModel>(OnPlanetChange); GameMessage.Listen <ClockTickMessage>(OnClockTick); }