Beispiel #1
0
 /// <summary>
 /// 设置不可视 ,开始隐藏
 /// </summary>
 public void Invisible()
 {
     if (this.visible)
     {
         if (this.bornEffect != null)
         {
             DelegateProxy.GameDestory(this.bornEffect);
         }
         if (this.isStatic)
         {
             if (this.ins != null)
             {
                 this.ins.SetActive(false);
             }
         }
         else if (this.ins != null)
         {
             this.ins.SetActive(false);
             if (this.activeListener != null)
             {
                 this.activeListener(false);
             }
         }
     }
     this.visible = false;
 }
Beispiel #2
0
 public void DestroyAll()
 {
     foreach (KeyValuePair <string, SpawnPool> current in this._pools)
     {
         DelegateProxy.GameDestory(current.Value);
     }
 }
Beispiel #3
0
 /// <summary>
 /// 释放内存和引用
 /// </summary>
 public void Release()
 {
     this.heightmap = null;
     if (this._heightmapTex != null)
     {
         DelegateProxy.GameDestory(this._heightmapTex);
         this._heightmapTex = null;
     }
 }
Beispiel #4
0
 public void Destroy()
 {
     this.terrainData.Release();
     this.terrainData = null;
     this.uvs         = null;
     this.vertices    = null;
     this.normals     = null;
     this.triangles   = null;
     this.tangents    = null;
     DelegateProxy.GameDestory(this.matrial);
     this.matrial = null;
     DelegateProxy.GameDestory(this.mesh);
     this.mesh = null;
 }
Beispiel #5
0
 public void Destroy()
 {
     this.waterData.Release();
     this.waterData = null;
     this.uvs       = null;
     this.vertices  = null;
     this.normals   = null;
     this.triangles = null;
     this.waterRenderer.material = null;
     this.waterRenderer          = null;
     DelegateProxy.GameDestory(this.matrial);
     this.matrial = null;
     DelegateProxy.GameDestory(Water.mesh);
     Water.mesh = null;
 }
Beispiel #6
0
    public bool Destroy(string poolName)
    {
        SpawnPool spawnPool;

        if (!this._pools.TryGetValue(poolName, out spawnPool))
        {
            if (CachePoolManager.bDebug)
            {
                LogSystem.LogWarning(new object[]
                {
                    string.Format("PoolManager: Unable to destroy '{0}'. Not in PoolManager", poolName)
                });
            }
            return(false);
        }
        DelegateProxy.GameDestory(spawnPool.gameObject);
        return(true);
    }
Beispiel #7
0
 /// <summary>
 /// 移除水体
 /// </summary>
 public void RemoveWater()
 {
     if (this.water != null)
     {
         if (GameScene.isPlaying)
         {
             DelegateProxy.GameDestory(this.water.gameObject);
         }
         else
         {
             DelegateProxy.DestroyObjectImmediate(this.water.gameObject);
         }
         this.water     = null;
         this.waterData = null;
         if (this.terrain != null)
         {
             this.terrain.hasWater = false;
             this.terrain.BuildMaterial(null);
         }
     }
 }
Beispiel #8
0
    public static void RemoveAllChildObject(GameObject parent, bool bImmediate)
    {
        int num = parent.transform.childCount - 1;

        while (0 <= num)
        {
            if (num < parent.transform.childCount)
            {
                Transform child = parent.transform.GetChild(num);
                if (bImmediate)
                {
                    DelegateProxy.DestroyObjectImmediate(child.gameObject);
                }
                else
                {
                    DelegateProxy.GameDestory(child.gameObject);
                }
            }
            num--;
        }
    }
Beispiel #9
0
 private void Awake()
 {
     DelegateProxy.GameDestory(base.gameObject);
 }
Beispiel #10
0
 /// <summary>
 /// 销毁回收
 /// </summary>
 public void Destroy()
 {
     if (GameScene.isPlaying)
     {
         if (this.waterData != null)
         {
             this.waterData.Release();
         }
         if (this.terrain != null)
         {
             this.terrain.Destroy();
             DelegateProxy.GameDestory(this.terrain);
             DelegateProxy.GameDestory(this.terrain.gameObject);
             this.terrain = null;
         }
         if (this.water != null)
         {
             this.water.Destroy();
             DelegateProxy.GameDestory(this.water);
             DelegateProxy.GameDestory(this.water.gameObject);
             this.water = null;
         }
     }
     else
     {
         if (this.terrain != null)
         {
             DelegateProxy.DestroyObjectImmediate(this.terrain.gameObject);
         }
         if (this.water != null)
         {
             DelegateProxy.DestroyObjectImmediate(this.water.gameObject);
         }
     }
     //同时销毁tile上的(静态)unit
     if (this.units != null)
     {
         while (this.units.Count > 0)
         {
             GameObjectUnit gameObjectUnit = this.units[0];
             //进行destory,放入cache待重用
             if (this.scene.ContainUnit(gameObjectUnit))
             {
                 this.scene.RemoveUnit(gameObjectUnit, true, true);
             }
             else
             {
                 //场景不包含的unit,销毁,并加入静态缓存待重用
                 gameObjectUnit.Destroy();
                 this.scene.RemoveEmptyUnit(gameObjectUnit);
             }
         }
         this.units.Clear();
         this.units = null;
         this.unitsMap.Clear();
         this.unitsMap = null;
     }
     this.left               = null;
     this.right              = null;
     this.top                = null;
     this.bot                = null;
     this.top_left           = null;
     this.top_right          = null;
     this.bot_left           = null;
     this.bot_right          = null;
     this.region             = null;
     this.scene              = null;
     this._lightmapPrototype = null;
     this.waterData          = null;
     this.heights            = new float[0, 0];
     this.grids              = new int[0, 0];
     this.heights            = null;
     this.grids              = null;
 }
Beispiel #11
0
 private void Update()
 {
     if (!this.m_bStartDetach)
     {
         this.m_bStartDetach = true;
         if (base.transform.parent != null)
         {
             this.m_ParentGameObject = base.transform.parent.gameObject;
             NcDetachObject.Create(this.m_ParentGameObject, base.transform.gameObject);
         }
         GameObject rootInstanceEffect = NcEffectBehaviour.GetRootInstanceEffect();
         if (this.m_bFollowParentTransform)
         {
             this.m_OriginalPos.SetLocalTransform(base.transform);
             base.ChangeParent(rootInstanceEffect.transform, base.transform, false, null);
             this.m_OriginalPos.CopyToLocalTransform(base.transform);
         }
         else
         {
             base.ChangeParent(rootInstanceEffect.transform, base.transform, false, null);
         }
         if (!this.m_bParentHideToStartDestroy)
         {
             this.StartDestroy();
         }
     }
     if (0f < this.m_fStartDestroyTime)
     {
         if (0f < this.m_fSmoothDestroyTime)
         {
             if (this.m_bSmoothHide)
             {
                 float num = 1f - (NcEffectBehaviour.GetEngineTime() - this.m_fStartDestroyTime) / this.m_fSmoothDestroyTime;
                 if (num < 0f)
                 {
                     num = 0f;
                 }
                 Renderer[] componentsInChildren = base.transform.GetComponentsInChildren <Renderer>(true);
                 for (int i = 0; i < componentsInChildren.Length; i++)
                 {
                     Renderer renderer          = componentsInChildren[i];
                     string   materialColorName = NcEffectBehaviour.GetMaterialColorName(renderer.material);
                     if (materialColorName != null)
                     {
                         Color color = renderer.material.GetColor(materialColorName);
                         color.a = Mathf.Min(num, color.a);
                         renderer.material.SetColor(materialColorName, color);
                     }
                 }
             }
             if (this.m_fStartDestroyTime + this.m_fSmoothDestroyTime < NcEffectBehaviour.GetEngineTime())
             {
                 DelegateProxy.GameDestory(base.gameObject);
             }
         }
     }
     else if (this.m_bParentHideToStartDestroy && (this.m_ParentGameObject == null || !NcEffectBehaviour.IsActive(this.m_ParentGameObject)))
     {
         this.StartDestroy();
     }
     if (this.m_bFollowParentTransform && this.m_ParentGameObject != null && this.m_ParentGameObject.transform != null)
     {
         NcTransformTool ncTransformTool = new NcTransformTool();
         ncTransformTool.SetTransform(this.m_OriginalPos);
         ncTransformTool.AddTransform(this.m_ParentGameObject.transform);
         ncTransformTool.CopyToLocalTransform(base.transform);
     }
 }
Beispiel #12
0
 /// <summary>
 /// 销毁unit游戏对象
 /// </summary>
 public virtual void Destroy()
 {
     if (this.destroyInsListener != null)
     {
         try
         {
             this.destroyInsListener();
         }
         catch (Exception ex)
         {
             LogSystem.LogError(new object[]
             {
                 "监听创建单位函数中出错!" + ex.ToString()
             });
         }
     }
     if (this.ins != null)
     {
         if (GameScene.isPlaying)
         {
             DelegateProxy.GameDestory(this.ins);
         }
         else
         {
             DelegateProxy.DestroyObjectImmediate(this.ins);
         }
     }
     if (this.combinUnitIDs != null)
     {
         this.combinUnitIDs.Clear();
     }
     this.combineParentUnitID = -1;
     if (this.tiles != null)
     {
         for (int i = 0; i < this.tiles.Count; i++)
         {
             this.tiles[i].RemoveUnit(this);
         }
         this.tiles.Clear();
     }
     if (this.materials != null)
     {
         this.materials.Clear();
         this.materials = null;
     }
     this.active = false;
     this.grids  = null;
     this.pre    = null;
     this.ins    = null;
     if (this.unitParser != null)
     {
         this.unitParser.Destroy();
         this.unitParser = null;
     }
     if (this.lightmapPrototypes != null)
     {
         this.lightmapPrototypes.Clear();
     }
     this.bornEffectPrePath  = string.Empty;
     this.bornEffect         = null;
     this.dataLength         = -1L;
     this.prePath            = string.Empty;
     this.createInsListener  = null;
     this.destroyInsListener = null;
     this.activeListener     = null;
     this.visible            = false;
     this.destroyed          = true;
     this.scene  = null;
     this.readed = false;
 }