예제 #1
0
    public void Save()
    {
        List <Vector3> allPoints = this.m_DestroyedObjects.GetAllPoints();

        SaveGame.SaveVal("SOMDestroyedCount", allPoints.Count);
        for (int i = 0; i < allPoints.Count; i++)
        {
            SaveGame.SaveVal("SOMPos" + i, allPoints[i]);
        }
        ObjectWithTrunk.OnSave();
    }
예제 #2
0
    public void Save()
    {
        List <Vector3> pointsInRadius = this.m_DestroyedObjects.GetPointsInRadius(Vector3.zero, float.MaxValue, false);

        SaveGame.SaveVal("SOMDestroyedCount", pointsInRadius.Count);
        for (int i = 0; i < pointsInRadius.Count; i++)
        {
            SaveGame.SaveVal("SOMPos" + i, pointsInRadius[i]);
        }
        ObjectWithTrunk.OnSave();
    }
예제 #3
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();
    }
예제 #4
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();
     }
 }
예제 #5
0
 public static void OnSave()
 {
     ObjectWithTrunk.DestroyObjects();
 }
예제 #6
0
 public static void OnLoad()
 {
     ObjectWithTrunk.DestroyObjects();
 }