Exemple #1
0
 public void DestroyFootprint()
 {
     if (this.mesh != null)
     {
         this.mesh.DestroyFootprintMesh();
         this.mesh = null;
     }
     if (this.secondaryMesh != null)
     {
         this.secondaryMesh.DestroyFootprintMesh();
         this.secondaryMesh = null;
     }
     if (this.validInnerMaterial != null)
     {
         UnityUtils.DestroyMaterial(this.validInnerMaterial);
         this.validInnerMaterial = null;
     }
     if (this.validOuterMaterial != null)
     {
         UnityUtils.DestroyMaterial(this.validOuterMaterial);
         this.validOuterMaterial = null;
     }
     if (this.invalidMaterial != null)
     {
         UnityUtils.DestroyMaterial(this.invalidMaterial);
         this.invalidMaterial = null;
     }
 }
Exemple #2
0
 protected void DestroyRenderObjects()
 {
     this.unityCamera.enabled = false;
     if (this.srcRenderTexture != null)
     {
         Service.Get <CameraManager>().ReleaseRenderTexture(this.srcRenderTexture, false);
         this.srcRenderTexture = null;
     }
     if (this.dstRenderTexture != null)
     {
         Service.Get <CameraManager>().ReleaseRenderTexture(this.dstRenderTexture, false);
         this.dstRenderTexture = null;
     }
     if (this.quadMesh != null)
     {
         UnityUtils.DestroyMesh(this.quadMesh);
         this.quadMesh = null;
     }
     if (this.quadMaterial != null)
     {
         UnityUtils.DestroyMaterial(this.quadMaterial);
         this.quadMaterial = null;
     }
     if (this.quadGameObject != null)
     {
         UnityEngine.Object.Destroy(this.quadGameObject);
         this.quadGameObject = null;
         this.quadMaterial   = null;
     }
 }
Exemple #3
0
        public void Cleanup()
        {
            if (this.Entity == null)
            {
                return;
            }
            Service.Get <ViewTimeEngine>().UnregisterFrameTimeObserver(this);
            GameObjectViewComponent gameObjectViewComponent = this.Entity.Get <GameObjectViewComponent>();

            if (gameObjectViewComponent != null)
            {
                gameObjectViewComponent.DetachGameObject(this.name);
            }
            if (this.material != null)
            {
                UnityUtils.DestroyMaterial(this.material);
                this.material = null;
            }
            if (this.view != null)
            {
                UnityEngine.Object.Destroy(this.view);
                this.view = null;
            }
            if (this.heroHandle != AssetHandle.Invalid)
            {
                Service.Get <AssetManager>().Unload(this.heroHandle);
                this.heroHandle = AssetHandle.Invalid;
            }
            this.Entity = null;
            this.hero   = null;
            this.name   = null;
            this.loaded = false;
            this.fading = false;
        }
Exemple #4
0
 public void Cleanup()
 {
     foreach (uint current in this.delayTimers.Values)
     {
         Service.ViewTimerManager.KillViewTimer(current);
     }
     this.delayTimers.Clear();
     foreach (ShieldBuildingInfo current2 in this.buildings.Values)
     {
         if (current2.Shield != null)
         {
             UnityEngine.Object.Destroy(current2.Shield.transform.root.gameObject);
             current2.Shield = null;
         }
         if (current2.Spark != null)
         {
             UnityEngine.Object.Destroy(current2.Spark.transform.root.gameObject);
             current2.Spark = null;
         }
         if (current2.Destruction != null)
         {
             UnityEngine.Object.Destroy(current2.Destruction.transform.root.gameObject);
             current2.Destruction = null;
         }
         if (current2.Generator != null)
         {
             UnityEngine.Object.Destroy(current2.Generator.transform.root.gameObject);
             current2.Generator = null;
         }
         if (current2.Top != null)
         {
             UnityEngine.Object.Destroy(current2.Top.transform.root.gameObject);
             current2.Top = null;
         }
         if (current2.DecalMaterial != null)
         {
             UnityUtils.DestroyMaterial(current2.DecalMaterial);
             current2.DecalMaterial = null;
         }
         if (current2.ShieldMaterial != null)
         {
             UnityUtils.DestroyMaterial(current2.ShieldMaterial);
             current2.ShieldMaterial = null;
         }
         if (current2.ShieldDisolveEffect != null)
         {
             current2.ShieldDisolveEffect.Cleanup();
             current2.ShieldDisolveEffect = null;
         }
         int i     = 0;
         int count = current2.AssetHandles.Count;
         while (i < count)
         {
             Service.AssetManager.Unload(current2.AssetHandles[i]);
             i++;
         }
         current2.AssetHandles = null;
     }
     this.buildings.Clear();
 }
Exemple #5
0
 public void Destroy()
 {
     if (this.planetMaterial != null)
     {
         UnityUtils.DestroyMaterial(this.planetMaterial);
         this.planetMaterial = null;
     }
     if (this.PlanetGameObject != null)
     {
         UnityEngine.Object.Destroy(this.PlanetGameObject);
         this.PlanetGameObject = null;
     }
     if (this.EventEffect != null)
     {
         UnityEngine.Object.Destroy(this.EventEffect);
         this.EventEffect = null;
     }
     if (this.PlanetGlowEffect != null)
     {
         UnityEngine.Object.Destroy(this.PlanetGlowEffect);
         this.PlanetGlowEffect = null;
     }
     this.DestroyParticles();
     this.Handle           = AssetHandle.Invalid;
     this.PlanetGameObject = null;
     this.VO            = null;
     this.ObjectExtents = Vector3.zero;
 }
 private void Destroy()
 {
     this.events.UnregisterObserver(this, EventId.MapDataProcessingStart);
     this.events.UnregisterObserver(this, EventId.WorldLoadComplete);
     this.events.UnregisterObserver(this, EventId.WorldInTransitionComplete);
     this.events.UnregisterObserver(this, EventId.TroopNotPlacedInvalidArea);
     this.events.UnregisterObserver(this, EventId.UserLiftedBuilding);
     this.events.UnregisterObserver(this, EventId.EnterEditMode);
     this.events.UnregisterObserver(this, EventId.ExitEditMode);
     this.events.UnregisterObserver(this, EventId.ShieldBorderDestroyed);
     this.events.UnregisterObserver(this, EventId.MissionStarted);
     this.IgnoreBoardChanges();
     if (this.textureHandle != AssetHandle.Invalid)
     {
         Service.Get <AssetManager>().Unload(this.textureHandle);
         this.textureHandle = AssetHandle.Invalid;
     }
     this.texture = null;
     if (this.material != null)
     {
         UnityUtils.DestroyMaterial(this.material);
         this.material = null;
     }
     this.CleanUp();
 }
 public override void OnRemove()
 {
     if (this.meterMaterial != null)
     {
         UnityUtils.DestroyMaterial(this.meterMaterial);
         this.meterMaterial = null;
     }
 }
Exemple #8
0
 private void DestroyMaterials()
 {
     for (int i = 0; i < this.decalMaterials.Count; i++)
     {
         UnityUtils.DestroyMaterial(this.decalMaterials[i]);
     }
     this.decalMaterials.Clear();
 }
 public void Cleanup()
 {
     if (this.loadedAssets)
     {
         if (this.effectObj != null)
         {
             UnityEngine.Object.Destroy(this.effectObj);
         }
         UnityUtils.DestroyMaterial(this.troopCardMaterial);
         AssetManager assetManager = Service.Get <AssetManager>();
         if (this.effectHandle != AssetHandle.Invalid)
         {
             assetManager.Unload(this.effectHandle);
             this.effectHandle = AssetHandle.Invalid;
         }
         if (this.troopHandle != AssetHandle.Invalid)
         {
             assetManager.Unload(this.troopHandle);
             this.troopHandle = AssetHandle.Invalid;
         }
     }
     if (this.shuttle == null)
     {
         Service.Get <EventManager>().UnregisterObserver(this, EventId.ShuttleAnimStateChanged);
     }
     else
     {
         this.shuttle = null;
     }
     if (this.timerId != 0u)
     {
         Service.Get <ViewTimerManager>().KillViewTimer(this.timerId);
     }
     else
     {
         this.timerId = 0u;
     }
     if (this.animPosition != null)
     {
         Service.Get <AnimController>().CompleteAndRemoveAnim(this.animPosition);
     }
     this.troopVO           = null;
     this.troopEntity       = null;
     this.starportEntity    = null;
     this.entityFader       = null;
     this.onFinished        = null;
     this.effectObj         = null;
     this.troopCardPS       = null;
     this.shuttleGlowPS     = null;
     this.troopCardTexture  = null;
     this.troopCardMaterial = null;
     this.animPosition      = null;
     this.showFullEffect    = false;
     this.pathReached       = false;
     Service.Get <EventManager>().UnregisterObserver(this, EventId.TroopViewReady);
     Service.Get <EventManager>().UnregisterObserver(this, EventId.BuildingMovedOnBoard);
     Service.Get <EventManager>().UnregisterObserver(this, EventId.BuildingReplaced);
 }
Exemple #10
0
 private void CleanUp()
 {
     this.destinationVO = null;
     if (this.hyperspaceHandle != AssetHandle.Invalid)
     {
         this.assetManager.Unload(this.hyperspaceHandle);
         this.hyperspaceHandle = AssetHandle.Invalid;
     }
     if (this.destinationHandle != AssetHandle.Invalid)
     {
         this.assetManager.Unload(this.destinationHandle);
         this.destinationHandle = AssetHandle.Invalid;
     }
     if (this.currentPlanetHandle != AssetHandle.Invalid)
     {
         this.assetManager.Unload(this.currentPlanetHandle);
         this.currentPlanetHandle = AssetHandle.Invalid;
     }
     if (this.currentPlanetGameObject != null)
     {
         UnityEngine.Object.Destroy(this.currentPlanetGameObject);
         this.currentPlanetGameObject = null;
     }
     if (this.destinationPlanetGameObject != null)
     {
         UnityEngine.Object.Destroy(this.destinationPlanetGameObject);
         this.destinationPlanetGameObject = null;
     }
     if (this.planetGlowGameObject != null)
     {
         UnityEngine.Object.Destroy(this.planetGlowGameObject);
         this.planetGlowGameObject = null;
     }
     if (this.assetHandlePlanetGlow != AssetHandle.Invalid)
     {
         this.assetManager.Unload(this.assetHandlePlanetGlow);
         this.assetHandlePlanetGlow = AssetHandle.Invalid;
     }
     if (this.assetHandleRelocationAudio != AssetHandle.Invalid)
     {
         this.assetManager.Unload(this.assetHandleRelocationAudio);
         this.assetHandleRelocationAudio = AssetHandle.Invalid;
     }
     if (this.hyperspaceGameObject != null)
     {
         UnityEngine.Object.Destroy(this.hyperspaceGameObject);
         this.hyperspaceGameObject = null;
     }
     if (this.transitionVisuals != null)
     {
         this.transitionVisuals.Cleanup();
         this.transitionVisuals = null;
     }
     UnityUtils.DestroyMaterial(this.planetMaterial);
     this.relocationInProgress = false;
 }
Exemple #11
0
 public override void InternalDestroyComponent()
 {
     this.UnloadCurrentTexture();
     if (this.material != null)
     {
         this.material.mainTexture = null;
         UnityUtils.DestroyMaterial(this.material);
         this.material = null;
     }
     this.component = null;
 }
Exemple #12
0
 public override void OnRemove()
 {
     if (this.ShadowMaterial != null)
     {
         UnityUtils.DestroyMaterial(this.ShadowMaterial);
         this.ShadowMaterial = null;
     }
     if (this.GameObj != null)
     {
         UnityEngine.Object.Destroy(this.GameObj);
         this.GameObj          = null;
         this.ShadowGameObject = null;
     }
 }
 public void DestroyBuildings()
 {
     if (this.participantBuildingsPlayer != null)
     {
         foreach (KeyValuePair <SquadWarBoardBuilding, SquadWarParticipantState> current in this.participantBuildingsPlayer)
         {
             current.get_Key().Destroy();
         }
         this.participantBuildingsPlayer.Clear();
     }
     if (this.participantBuildingsOpponent != null)
     {
         foreach (KeyValuePair <SquadWarBoardBuilding, SquadWarParticipantState> current2 in this.participantBuildingsOpponent)
         {
             current2.get_Key().Destroy();
         }
         this.participantBuildingsOpponent.Clear();
     }
     if (this.assetHandles != null)
     {
         AssetManager assetManager = Service.Get <AssetManager>();
         int          i            = 0;
         int          count        = this.assetHandles.Count;
         while (i < count)
         {
             assetManager.Unload(this.assetHandles[i]);
             i++;
         }
         this.assetHandles.Clear();
     }
     if (this.unsharedMaterials != null)
     {
         int j      = 0;
         int count2 = this.unsharedMaterials.Count;
         while (j < count2)
         {
             UnityUtils.DestroyMaterial(this.unsharedMaterials[j]);
             j++;
         }
         this.unsharedMaterials.Clear();
     }
     if (this.outline != null)
     {
         this.outline.Cleanup();
     }
     this.ResetPressedBuilding();
     this.selectedBuilding = null;
     Service.Get <UserInputManager>().UnregisterObserver(this, UserInputLayer.World);
     Service.Get <ViewTimeEngine>().UnregisterFrameTimeObserver(this);
 }
        public void Destroy()
        {
            this.baseRenderer.Destroy();
            this.baseRenderer = null;
            int i     = 0;
            int count = this.unsharedMaterials.Count;

            while (i < count)
            {
                UnityUtils.DestroyMaterial(this.unsharedMaterials[i]);
                i++;
            }
            this.unsharedMaterials.Clear();
        }
Exemple #15
0
        private void DestroyShaderSwappedMaterials()
        {
            int count = this.cleanUpList.Count;

            for (int i = 0; i < count; i++)
            {
                UnityUtils.DestroyMaterial(this.cleanUpList[i]);
            }
            this.cleanUpList.Clear();
            if (this.shaderSwappedMaterials != null)
            {
                this.shaderSwappedMaterials.Clear();
                this.shaderSwappedMaterials = null;
            }
        }
Exemple #16
0
        public override void OnDestroyElement()
        {
            Service.UXController.HUD.Visible = true;
            if (this.itemGrid != null)
            {
                this.itemGrid.Clear();
                this.itemGrid = null;
            }
            base.OnDestroyElement();
            if (this.buildingHq != null)
            {
                UnityEngine.Object.Destroy(this.buildingHq);
                this.buildingHq       = null;
                this.buildingHqShadow = null;
            }
            if (this.celebrationRig != null)
            {
                UnityEngine.Object.Destroy(this.celebrationRig);
                this.celebrationRig = null;
            }
            int i     = 0;
            int count = this.outLineMatList.Count;

            while (i < count)
            {
                Material material = this.outLineMatList[i];
                if (material != null)
                {
                    UnityUtils.DestroyMaterial(material);
                }
                i++;
            }
            this.outLineMatList.Clear();
            if (this.buildingHandle != AssetHandle.Invalid)
            {
                Service.AssetManager.Unload(this.buildingHandle);
                this.buildingHandle = AssetHandle.Invalid;
            }
            if (this.rigHandle != AssetHandle.Invalid)
            {
                Service.AssetManager.Unload(this.rigHandle);
                this.rigHandle = AssetHandle.Invalid;
            }
            if (this.fadingOutBuilding)
            {
                Service.ViewTimeEngine.UnregisterFrameTimeObserver(this);
            }
        }
Exemple #17
0
 public void Destroy()
 {
     this.baseRenderer.Destroy();
     this.baseRenderer = null;
     if (this.materialCopies != null)
     {
         int i     = 0;
         int count = this.materialCopies.Count;
         while (i < count)
         {
             UnityUtils.DestroyMaterial(this.materialCopies[i]);
             i++;
         }
         this.materialCopies.Clear();
     }
 }
Exemple #18
0
 public void Complete()
 {
     this.RestoreMaterials();
     if (this.flashingMaterials != null)
     {
         int i     = 0;
         int count = this.flashingMaterials.Count;
         while (i < count)
         {
             UnityUtils.DestroyMaterial(this.flashingMaterials[i]);
             i++;
         }
         this.flashingMaterials = null;
     }
     this.oldMaterials = null;
 }
        public override void OnDestroyElement()
        {
            if (this.itemGrid != null)
            {
                this.itemGrid.Clear();
                this.itemGrid = null;
            }
            base.OnDestroyElement();
            if (this.subject != null)
            {
                UnityEngine.Object.Destroy(this.subject);
                this.subject = null;
            }
            if (this.rig != null)
            {
                UnityEngine.Object.Destroy(this.rig);
                this.rig = null;
            }
            int i     = 0;
            int count = this.outLineMatList.Count;

            while (i < count)
            {
                Material material = this.outLineMatList[i];
                if (material != null)
                {
                    UnityUtils.DestroyMaterial(material);
                }
                i++;
            }
            this.outLineMatList.Clear();
            if (this.subjectHandle != AssetHandle.Invalid)
            {
                Service.Get <AssetManager>().Unload(this.subjectHandle);
                this.subjectHandle = AssetHandle.Invalid;
            }
            if (this.rigHandle != AssetHandle.Invalid)
            {
                Service.Get <AssetManager>().Unload(this.rigHandle);
                this.rigHandle = AssetHandle.Invalid;
            }
            if (this.fadingOutSubject)
            {
                Service.Get <ViewTimeEngine>().UnregisterFrameTimeObserver(this);
            }
        }
Exemple #20
0
 public void Cleanup()
 {
     if (this.assetHandle != AssetHandle.Invalid)
     {
         base.Unload(this.assetHandle, this.planet.LoadingScreenAssetName);
         this.assetHandle = AssetHandle.Invalid;
     }
     if (this.modelGameObject != null)
     {
         UnityEngine.Object.Destroy(this.modelGameObject);
         this.modelGameObject = null;
     }
     if (this.assetHandleModels != AssetHandle.Invalid)
     {
         this.assetManager.Unload(this.assetHandleModels);
         this.assetHandleModels = AssetHandle.Invalid;
     }
     if (this.assetHandlePlanet != AssetHandle.Invalid)
     {
         this.assetManager.Unload(this.assetHandlePlanet);
         this.assetHandlePlanet = AssetHandle.Invalid;
     }
     if (this.assetHandlePlanetGlow != AssetHandle.Invalid)
     {
         this.assetManager.Unload(this.assetHandlePlanetGlow);
         this.assetHandlePlanetGlow = AssetHandle.Invalid;
     }
     if (this.starsGameObject != null)
     {
         UnityEngine.Object.Destroy(this.starsGameObject);
         this.starsGameObject = null;
     }
     if (this.assetHandleStars != AssetHandle.Invalid)
     {
         this.assetManager.Unload(this.assetHandleStars);
         this.assetHandleStars = AssetHandle.Invalid;
     }
     Service.CameraManager.UXSceneCamera.Camera.enabled = false;
     UnityUtils.DestroyMaterial(this.planetMaterial);
     base.DestroyFactory();
 }
Exemple #21
0
        private void UnloadShuttle(ShuttleAnim anim)
        {
            anim.Stop();
            if (anim.ShadowMaterial != null)
            {
                UnityUtils.DestroyMaterial(anim.ShadowMaterial);
                anim.ShadowMaterial = null;
            }
            AssetManager assetManager = Service.Get <AssetManager>();

            if (anim.GameObj != null)
            {
                UnityEngine.Object.Destroy(anim.GameObj);
                anim.GameObj = null;
            }
            if (anim.MainHandle != AssetHandle.Invalid)
            {
                assetManager.Unload(anim.MainHandle);
                anim.MainHandle = AssetHandle.Invalid;
            }
            if (anim.LandingEffect != null)
            {
                UnityEngine.Object.Destroy(anim.LandingEffect);
                anim.LandingEffect = null;
            }
            if (anim.LandingHandle != AssetHandle.Invalid)
            {
                assetManager.Unload(anim.LandingHandle);
                anim.LandingHandle = AssetHandle.Invalid;
            }
            if (anim.TakeOffEffect != null)
            {
                UnityEngine.Object.Destroy(anim.TakeOffEffect);
                anim.TakeOffEffect = null;
            }
            if (anim.TakeoffHandle != AssetHandle.Invalid)
            {
                assetManager.Unload(anim.TakeoffHandle);
                anim.TakeoffHandle = AssetHandle.Invalid;
            }
        }
Exemple #22
0
 public void Complete()
 {
     this.HandleStarted();
     this.RestoreMaterials();
     if (this.fadingMaterials != null)
     {
         int i     = 0;
         int count = this.fadingMaterials.Count;
         while (i < count)
         {
             UnityUtils.DestroyMaterial(this.fadingMaterials[i]);
             i++;
         }
         this.fadingMaterials = null;
     }
     if (this.onComplete != null)
     {
         this.onComplete(this.fadingObject);
         this.onComplete = null;
     }
 }
Exemple #23
0
        public void CleanupShield(Entity building)
        {
            if (!this.buildings.ContainsKey(building))
            {
                return;
            }
            ShieldBuildingInfo      shieldBuildingInfo      = this.buildings[building];
            GameObjectViewComponent gameObjectViewComponent = building.Get <GameObjectViewComponent>();

            if (shieldBuildingInfo.Shield != null)
            {
                GameObject shield = shieldBuildingInfo.Shield;
                UnityEngine.Object.Destroy(shield.transform.root.gameObject);
                shieldBuildingInfo.Shield = null;
                gameObjectViewComponent.DetachGameObject("shield");
            }
            if (shieldBuildingInfo.Spark != null)
            {
                ParticleSystem spark = shieldBuildingInfo.Spark;
                UnityEngine.Object.Destroy(spark.transform.root.gameObject);
                shieldBuildingInfo.Spark = null;
                gameObjectViewComponent.DetachGameObject("spark");
            }
            if (shieldBuildingInfo.Destruction != null)
            {
                ParticleSystem destruction = shieldBuildingInfo.Destruction;
                UnityEngine.Object.Destroy(destruction.transform.root.gameObject);
                shieldBuildingInfo.Destruction = null;
                gameObjectViewComponent.DetachGameObject("destroy");
            }
            if (shieldBuildingInfo.Generator != null)
            {
                GameObject generator = shieldBuildingInfo.Generator;
                UnityEngine.Object.Destroy(generator.transform.root.gameObject);
                shieldBuildingInfo.Generator = null;
                gameObjectViewComponent.DetachGameObject("beam");
            }
            if (shieldBuildingInfo.Top != null)
            {
                GameObject top = shieldBuildingInfo.Top;
                UnityEngine.Object.Destroy(top.transform.root.gameObject);
                shieldBuildingInfo.Top = null;
                gameObjectViewComponent.DetachGameObject("top");
            }
            if (shieldBuildingInfo.DecalMaterial != null)
            {
                UnityUtils.DestroyMaterial(shieldBuildingInfo.DecalMaterial);
                shieldBuildingInfo.DecalMaterial = null;
            }
            if (shieldBuildingInfo.ShieldMaterial != null)
            {
                UnityUtils.DestroyMaterial(shieldBuildingInfo.ShieldMaterial);
                shieldBuildingInfo.ShieldMaterial = null;
            }
            if (this.delayTimers.ContainsKey(building))
            {
                uint id = this.delayTimers[building];
                Service.ViewTimerManager.KillViewTimer(id);
                this.delayTimers.Remove(building);
            }
            int i     = 0;
            int count = shieldBuildingInfo.AssetHandles.Count;

            while (i < count)
            {
                Service.AssetManager.Unload(shieldBuildingInfo.AssetHandles[i]);
                i++;
            }
            shieldBuildingInfo.AssetHandles = null;
            this.buildings.Remove(building);
        }