Exemple #1
0
        public float GetBuildingProductionProgress(int id)
        {
            BuildingControl building = GetBuildingById(id);

            if (building == null)
            {
                return(0);
            }
            return(building.ProductionProgress);
        }
Exemple #2
0
        public void OnStartBuildingProduction(int id)
        {
            if (GetBuildingIsWorking(id))
            {
                return;
            }

            BuildingControl building = GetBuildingById(id);

            building.OnStartBuildingProduction();
        }
Exemple #3
0
        public int BuildNew(BuildingInfoModel building)
        {
            IdCounter++;
            BuildingControl newBuilding = new BuildingControl
            {
                Id           = IdCounter,
                BuildingInfo = building
            };

            newBuilding.ProductionIsFinished += ProductionIsFinished;
            newBuilding.Init();
            _buildings.Add(newBuilding);

            return(IdCounter);
        }
Exemple #4
0
        public bool GetBuildingIsWorking(int id)
        {
            BuildingControl building = GetBuildingById(id);

            return(building != null && building.IsWorking);
        }
Exemple #5
0
        public BuildingInfoModel GetBuildingInfo(int id)
        {
            BuildingControl building = GetBuildingById(id);

            return(building?.BuildingInfo);
        }
Exemple #6
0
 private void ProductionIsFinished(BuildingControl building)
 {
     ProductionIsFinishedAction?.Invoke(building.Id, building.BuildingInfo);
 }