Example #1
0
 protected override void Start()
 {
     base.Start();
     this.SetPlacesToAttach();
     this.SetPlacesToAttachTo();
     this.m_ConstructionInfo = (ConstructionInfo)this.m_Info;
     for (int i = 0; i < this.m_ConstructionSlots.Length; i++)
     {
         ConstructionSlot constructionSlot = this.m_ConstructionSlots[i];
         foreach (Construction construction in Construction.s_AllConstructions)
         {
             if (!(construction == this) && construction.m_Initialized && constructionSlot.m_MatchingItemIDs.Contains(construction.GetInfoID()) && (constructionSlot.transform.position - construction.transform.position).sqrMagnitude < 0.01f)
             {
                 constructionSlot.SetConstruction(construction);
                 break;
             }
         }
     }
     if (this.m_DisableFrame)
     {
         foreach (Construction construction2 in this.m_ConnectedConstructions)
         {
             ConstructionSlot[] constructionSlots = construction2.m_ConstructionSlots;
             for (int j = 0; j < constructionSlots.Length; j++)
             {
                 if (constructionSlots[j].m_Construction == this)
                 {
                     construction2.ItemsManagerUnregister();
                     construction2.gameObject.SetActive(false);
                 }
             }
         }
     }
 }
Example #2
0
 public override void Save(int index)
 {
     base.Save(index);
     for (int i = 0; i < this.m_ConstructionSlots.Length; i++)
     {
         ConstructionSlot constructionSlot = this.m_ConstructionSlots[i];
         SaveGame.SaveVal(string.Concat(new object[]
         {
             "ConstructionSlot",
             index,
             constructionSlot.name,
             i
         }), constructionSlot.m_Construction != null);
         if (constructionSlot.m_Construction != null)
         {
             SaveGame.SaveVal(string.Concat(new object[]
             {
                 "ConstructionSlotPos",
                 index,
                 constructionSlot.name,
                 i
             }), constructionSlot.m_Construction.transform.position);
         }
     }
     SaveGame.SaveVal("ConstructionUpperLevel" + index, this.m_UpperLevel);
     SaveGame.SaveVal("ConstructionLevel" + index, this.m_Level);
     SaveGame.SaveVal("ConstructionBelow" + index, this.m_ConstructionBelow ? this.m_ConstructionBelow.transform.position : Vector3.zero);
     SaveGame.SaveVal("ConstructionBelowName" + index, this.m_ConstructionBelow ? this.m_ConstructionBelow.name : "None");
 }
Example #3
0
 public override void SetupAfterLoad(int index)
 {
     base.SetupAfterLoad(index);
     IFirecampAttach[] components = base.gameObject.GetComponents <IFirecampAttach>();
     if (components.Length != 0)
     {
         Bounds bounds = new Bounds(base.transform.TransformPoint(this.m_BoxCollider.center), this.m_BoxCollider.size);
         for (int i = 0; i < Firecamp.s_Firecamps.Count; i++)
         {
             Firecamp firecamp = Firecamp.s_Firecamps[i];
             if (!(firecamp.gameObject == base.gameObject))
             {
                 Bounds bounds2 = new Bounds(firecamp.transform.TransformPoint(firecamp.m_BoxCollider.center), firecamp.m_BoxCollider.size);
                 if (bounds.Intersects(bounds2))
                 {
                     for (int j = 0; j < components.Length; j++)
                     {
                         components[j].SetFirecamp(firecamp);
                     }
                 }
             }
         }
     }
     if (SaveGame.m_SaveGameVersion >= GreenHellGame.s_GameVersionEarlyAccessUpdate4)
     {
         for (int k = 0; k < this.m_ConstructionSlots.Length; k++)
         {
             ConstructionSlot constructionSlot = this.m_ConstructionSlots[k];
             if (SaveGame.LoadBVal(string.Concat(new object[]
             {
                 "ConstructionSlot",
                 index,
                 constructionSlot.name,
                 k
             })))
             {
                 Vector3 a = SaveGame.LoadV3Val(string.Concat(new object[]
                 {
                     "ConstructionSlotPos",
                     index,
                     constructionSlot.name,
                     k
                 }));
                 foreach (Construction construction in Construction.s_AllConstructions)
                 {
                     if (!(construction == this) && (a - construction.transform.position).sqrMagnitude < 0.01f && constructionSlot.m_MatchingItemIDs.Contains(construction.GetInfoID()))
                     {
                         constructionSlot.SetConstruction(construction);
                         break;
                     }
                 }
             }
         }
     }
     foreach (Construction construction2 in Construction.s_AllConstructions)
     {
         if (!(construction2 == this) && (this.m_ConstructionBelowPos - construction2.transform.position).sqrMagnitude < 0.01f && this.m_ConstructionBelowName == construction2.name)
         {
             this.m_ConstructionBelow = construction2;
             break;
         }
     }
     this.SetUpperLevel(this.m_UpperLevel, this.m_Level);
 }