コード例 #1
0
    public void Load()
    {
        foreach (GameObject obj in this.m_ReplacedMap.Values)
        {
            UnityEngine.Object.Destroy(obj);
        }
        this.m_ReplacedMap.Clear();
        this.m_ObjectsRemovedFromStatic.Clear();
        this.EnableObjectsInQuadTree();
        List <Vector3> allPoints = this.m_DestroyedObjects.GetAllPoints();

        for (int i = 0; i < allPoints.Count; i++)
        {
            StaticObjectClass objectsInPos = this.m_QuadTree.GetObjectsInPos(allPoints[i]);
            if (objectsInPos != null && objectsInPos.m_GameObject != null)
            {
                objectsInPos.m_GameObject.SetActive(true);
                if (objectsInPos.m_GameObject.transform.parent != null)
                {
                    objectsInPos.m_GameObject.transform.parent.gameObject.SetActive(true);
                }
                objectsInPos.m_State = 0;
            }
        }
        this.m_DestroyedObjects.Clear();
        int num = 0;

        SaveGame.LoadVal("SOMDestroyedCount", out num, false);
        Vector3 zero = Vector3.zero;

        for (int j = 0; j < num; j++)
        {
            SaveGame.LoadVal("SOMPos" + j, out zero, false);
            StaticObjectClass objectsInPos2 = this.m_QuadTree.GetObjectsInPos(zero);
            if (objectsInPos2 != null && objectsInPos2.m_GameObject != null)
            {
                objectsInPos2.m_GameObject.SetActive(false);
                if (objectsInPos2.m_GameObject.transform.parent != null)
                {
                    objectsInPos2.m_GameObject.transform.parent.gameObject.SetActive(false);
                }
            }
            this.m_DestroyedObjects.InsertPoint(zero, false);
        }
        ObjectWithTrunk.OnLoad();
        this.OnLoaded();
    }
コード例 #2
0
 public override void OnReplicationDeserialize(P2PNetworkReader reader, bool initial_state)
 {
     if (initial_state)
     {
         foreach (GameObject obj in this.m_ReplacedMap.Values)
         {
             UnityEngine.Object.Destroy(obj);
         }
         this.m_ReplacedMap.Clear();
         this.m_ObjectsRemovedFromStatic.Clear();
         this.EnableObjectsInQuadTree();
         List <Vector3> allPoints = this.m_DestroyedObjects.GetAllPoints();
         for (int i = 0; i < allPoints.Count; i++)
         {
             StaticObjectClass objectsInPos = this.m_QuadTree.GetObjectsInPos(allPoints[i]);
             if (objectsInPos != null && objectsInPos.m_GameObject != null)
             {
                 objectsInPos.m_GameObject.SetActive(true);
                 if (objectsInPos.m_GameObject.transform.parent != null)
                 {
                     objectsInPos.m_GameObject.transform.parent.gameObject.SetActive(true);
                 }
                 objectsInPos.m_State = 0;
             }
         }
         this.m_DestroyedObjects.Clear();
         ushort num = reader.ReadUInt16();
         for (int j = 0; j < (int)num; j++)
         {
             Vector3           vector        = reader.ReadVector3();
             StaticObjectClass objectsInPos2 = this.m_QuadTree.GetObjectsInPos(vector);
             if (objectsInPos2 != null && objectsInPos2.m_GameObject != null)
             {
                 objectsInPos2.m_GameObject.SetActive(false);
                 if (objectsInPos2.m_GameObject.transform.parent != null)
                 {
                     objectsInPos2.m_GameObject.transform.parent.gameObject.SetActive(false);
                 }
             }
             this.m_DestroyedObjects.InsertPoint(vector, false);
         }
         ObjectWithTrunk.OnLoad();
         this.OnLoaded();
     }
 }