コード例 #1
0
    protected override void OnCompleteWork(Worker worker)
    {
        PrimaryElement  component  = GetComponent <PrimaryElement>();
        Building        building   = GetComponent <Building>();
        SimCellOccupier component2 = GetComponent <SimCellOccupier>();

        if ((UnityEngine.Object)DetailsScreen.Instance != (UnityEngine.Object)null && DetailsScreen.Instance.CompareTargetWith(base.gameObject))
        {
            DetailsScreen.Instance.Show(false);
        }
        float temperature   = component.Temperature;
        byte  disease_idx   = component.DiseaseIdx;
        int   disease_count = component.DiseaseCount;

        if ((UnityEngine.Object)component2 != (UnityEngine.Object)null)
        {
            if (building.Def.TileLayer != ObjectLayer.NumLayers)
            {
                int num = Grid.PosToCell(base.transform.GetPosition());
                if ((UnityEngine.Object)Grid.Objects[num, (int)building.Def.TileLayer] == (UnityEngine.Object)base.gameObject)
                {
                    Grid.Objects[num, (int)building.Def.ObjectLayer] = null;
                    Grid.Objects[num, (int)building.Def.TileLayer]   = null;
                    Grid.Foundation[num] = false;
                    TileVisualizer.RefreshCell(num, building.Def.TileLayer, building.Def.ReplacementLayer);
                }
            }
            component2.DestroySelf(delegate
            {
                TriggerDestroy(building, temperature, disease_idx, disease_count);
            });
        }
        else
        {
            TriggerDestroy(building, temperature, disease_idx, disease_count);
        }
        string sound = GlobalAssets.GetSound("Finish_Deconstruction_" + building.Def.AudioSize, false);

        if (sound != null)
        {
            KMonoBehaviour.PlaySound3DAtLocation(sound, base.gameObject.transform.GetPosition());
        }
        Trigger(-702296337, this);
    }