Exemplo n.º 1
0
        private void BuildingProgressBarClick(UIComponent progressBar, UIMouseEventParameter eventParam)
        {
            ushort buildingID        = this.getSelectedBuildingID();
            Level  buildingLockLevel = Buildings.getLockLevel(buildingID);
            Level  progressBarLevel  = this.getProgressBarLevel(progressBar);

            if (buildingLockLevel == Level.None)
            {
                Buildings.add(buildingID, progressBarLevel);
                this.updateBuildingView(buildingID, progressBarLevel);
                #if DEBUG
                Logger.Info("building lock level (" + buildingID + "): " + progressBarLevel);
                #endif
            }
            else
            {
                if (buildingLockLevel == progressBarLevel)
                {
                    Buildings.remove(buildingID);
                    this.updateBuildingView(buildingID, Level.None);
                    #if DEBUG
                    Logger.Info("building lock level (" + buildingID + "): none");
                    #endif
                }
                else
                {
                    Buildings.update(buildingID, progressBarLevel);
                    this.updateBuildingView(buildingID, progressBarLevel);
                    #if DEBUG
                    Logger.Info("building lock level (" + buildingID + "): " + progressBarLevel);
                    #endif
                }
            }
        }
Exemplo n.º 2
0
        private void bulldozeBuilding(ushort buildingID)
        {
            try {
                BuildingManager buildingManager = Singleton <BuildingManager> .instance;
                Building        building        = buildingManager.m_buildings.m_buffer[buildingID];
                BuildingInfo    buildingInfo    = building.Info;

                buildingManager.ReleaseBuilding(buildingID);
                Buildings.remove(buildingID);

                /*
                 * EffectInfo effect = buildingManager.m_properties.m_bulldozeEffect;
                 * if (effect != null) {
                 *  InstanceID instance = new InstanceID();
                 *  Vector3 pos = building.m_position;
                 *  float angle = building.m_angle;
                 *  int length = building.Length;
                 *
                 *  EffectInfo.SpawnArea spawnArea = new EffectInfo.SpawnArea(
                 *      Matrix4x4.TRS(Building.CalculateMeshPosition(buildingInfo, pos, angle, length),
                 *      Building.CalculateMeshRotation(angle), Vector3.one), buildingInfo.m_lodMeshData);
                 *
                 *  AudioGroup nullAudioGroup = new AudioGroup(0,
                 *      new SavedFloat("NOTEXISTINGELEMENT", Settings.gameSettingsFile, 0, false));
                 *  Singleton<EffectManager>.instance.DispatchEffect(effect, instance, spawnArea,
                 *      Vector3.zero, 0.0f, 1f, nullAudioGroup);
                 * }
                 */
            } catch (Exception e) {
                Logger.Error("Error during bulldozing building :" + e.Message);
            }
        }