Ejemplo n.º 1
0
        public Town(int id, int playerId, string name, NVector pos)
        {
            this.id       = id;
            this.playerId = playerId;
            this.name     = name;
            this.pos      = pos.Clone();
            level         = 1;
            overlay       = new MapOverlay();

            res               = new Dictionary <string, double>();
            res[C.Worker]     = 0;
            res[C.Inhabitant] = 0;
            resStatistic      = new RoundResStatistic();
            resStatistic.NextRound();

            modi      = new Dictionary <string, string>();
            info      = new TownInfoMgmt();
            info.town = this;

            //todo add dynamic
            if (L.b.gameOptions["usageTown"].Bool())
            {
                modi["produce"] = "125%";
            }
        }
Ejemplo n.º 2
0
        public void Init(string configType, int player, NVector pos, Dictionary <string, int> cost)
        {
            Debug.Log($"{player}: Create unit {configType} at {pos}");
            baseData = dataUnit = L.b.units[configType];
            var calc = CalculatedData.Calc(dataUnit, cost);

            data = new BuildingUnitData();
            data.UnitInit(this, configType, -1, player, calc);
            data.pos = pos.Clone();

            //has a town?
            Town t = S.Towns().NearestTown(S.Player(player), pos, false);

            if (t != null)
            {
                int buildtime = L.b.modifiers[C.BuildRes].CalcModi(calc.buildTime, S.Player(player), pos);

                data.townId = t.id;
                gameObject.AddComponent <Construction>().Init(data, cost, this, buildtime);
                S.Player(player).fog.Clear(pos);
            }
            else
            {
                Clear(pos);
            }

            FinishInit();
        }
Ejemplo n.º 3
0
        public void Init(int town, string configType, NVector pos, Dictionary <string, int> cost)
        {
            Debug.Log($"Create building {configType} at {pos} for town {town}");
            baseData = dataBuilding = L.b.buildings[configType];
            var calc = CalculatedData.Calc(dataBuilding, cost);

            data = new BuildingUnitData();
            data.BuildingInit(this, configType, town, calc);
            data.pos = pos.Clone();

            int buildtime = L.b.modifiers[C.BuildRes].CalcModi(calc.buildTime, S.Towns().Get(town).Player(), pos);

            gameObject.AddComponent <Construction>().Init(data, cost, this, buildtime);

            S.Player(Town().playerId).fog.Clear(pos);

            FinishInit();
        }