public static void SetupObjects() { SaveGame.m_Objects.Clear(); SaveGame.m_Objects.Add(MainLevel.Instance); SaveGame.m_Objects.Add(Scenario.Get()); SaveGame.m_Objects.Add(AIManager.Get()); SaveGame.m_Objects.Add(TriggersManager.Get()); SaveGame.m_Objects.Add(ItemsManager.Get()); SaveGame.m_Objects.Add(SensorManager.Get()); SaveGame.m_Objects.Add(ConstructionGhostManager.Get()); SaveGame.m_Objects.Add(StaticObjectsManager.Get()); SaveGame.m_Objects.Add(Player.Get()); SaveGame.m_Objects.Add(PlayerConditionModule.Get()); SaveGame.m_Objects.Add(PlayerInjuryModule.Get()); SaveGame.m_Objects.Add(PlayerDiseasesModule.Get()); SaveGame.m_Objects.Add(StatsManager.Get()); SaveGame.m_Objects.Add(HintsManager.Get()); SaveGame.m_Objects.Add(ObjectivesManager.Get()); SaveGame.m_Objects.Add(HUDObjectives.Get()); SaveGame.m_Objects.Add(MenuNotepad.Get()); SaveGame.m_Objects.Add(MapTab.Get()); SaveGame.m_Objects.Add(Music.Get()); SaveGame.m_Objects.Add(RainManager.Get()); SaveGame.m_Objects.Add(BalanceSystem.Get()); }
protected override void Start() { base.Start(); this.m_BoxCollider = base.gameObject.GetComponent <BoxCollider>(); DebugUtils.Assert(this.m_BoxCollider, "[ConstructionGhost::Start] Can't find box collider!", true, DebugUtils.AssertType.Info); Physics.IgnoreCollision(Player.Get().GetComponent <Collider>(), this.m_BoxCollider); if (this.m_State == ConstructionGhost.GhostState.None) { this.SetState(ConstructionGhost.GhostState.Building); } this.m_ItemLayer = LayerMask.NameToLayer("Item"); this.m_LayerMasksToIgnore.Add(LayerMask.NameToLayer("NoCollisionWithPlayer")); this.m_LayerMasksToIgnore.Add(LayerMask.NameToLayer("SmallPlant")); this.m_LayerMasksToIgnore.Add(this.m_ItemLayer); this.m_ShaderOfCollidingPlant = Shader.Find("Shader Forge/select_yellow_shader"); this.SetupAudio(); this.m_ShaderPropertyFresnelColor = Shader.PropertyToID("_fresnelcolor"); this.m_AvailableCol = Color.white; this.m_NotAvailableHardCol = new Color(0.854f, 0.149f, 0.149f, 0.627f); this.m_NotAvailableSoftCol = Color.yellow; this.m_AvailableColorFresnel = new Color(1f, 1f, 1f, 1f); this.m_NotAvailableHardColorFresnel = new Color(1f, 0.196f, 0.196f, 0f); this.m_NotAvailableSoftColorFresnel = new Color(1f, 0.92f, 0.016f, 1f); ConstructionGhostManager.Get().RegisterGhost(this); }
public static void SetupObjects() { SaveGame.m_Objects.Clear(); SaveGame.m_Objects.Add(DifficultySettings.Get()); SaveGame.m_Objects.Add(DialogsManager.Get()); SaveGame.m_Objects.Add(AIManager.Get()); SaveGame.m_Objects.Add(EnemyAISpawnManager.Get()); SaveGame.m_Objects.Add(TriggersManager.Get()); SaveGame.m_Objects.Add(ItemsManager.Get()); SaveGame.m_Objects.Add(SensorManager.Get()); SaveGame.m_Objects.Add(ConstructionGhostManager.Get()); SaveGame.m_Objects.Add(StaticObjectsManager.Get()); SaveGame.m_Objects.Add(Player.Get()); SaveGame.m_Objects.Add(PlayerConditionModule.Get()); SaveGame.m_Objects.Add(PlayerInjuryModule.Get()); SaveGame.m_Objects.Add(PlayerDiseasesModule.Get()); SaveGame.m_Objects.Add(StatsManager.Get()); SaveGame.m_Objects.Add(HintsManager.Get()); SaveGame.m_Objects.Add(ObjectivesManager.Get()); SaveGame.m_Objects.Add(StoryObjectivesManager.Get()); SaveGame.m_Objects.Add(HUDObjectives.Get()); SaveGame.m_Objects.Add(MenuNotepad.Get()); SaveGame.m_Objects.Add(MapTab.Get()); SaveGame.m_Objects.Add(Music.Get()); SaveGame.m_Objects.Add(RainManager.Get()); SaveGame.m_Objects.Add(SleepController.Get()); SaveGame.m_Objects.Add(MainLevel.Instance); SaveGame.m_Objects.Add(ScenarioManager.Get()); SaveGame.m_Objects.Add(InventoryBackpack.Get()); SaveGame.m_Objects.Add(ReplicatedSessionState.Get()); }
protected override void OnEnable() { base.OnEnable(); if (ConstructionGhostManager.Get()) { ConstructionGhostManager.Get().RegisterGhost(this); } }
protected override void OnDisable() { base.OnDisable(); int i = 0; while (i < this.m_CollidingPlants.Count) { this.RemoveCollidingPlant(this.m_CollidingPlants.Keys.ElementAt(i)); } ConstructionGhostManager.Get().UnregisterGhost(this); }
public virtual void DestroyMe(bool check_connected = true) { if (this.m_Destroying) { return; } foreach (Construction construction in Construction.s_AllConstructions) { if (!(construction == this) && construction != null) { construction.OnOtherConstructionDestroyed(this); } } this.ResolveSlots(); if (!Replicator.IsAnyObjectBeingDeserialized()) { this.ReplRequestOwnership(false); } FoodProcessor component = base.gameObject.GetComponent <FoodProcessor>(); if (component) { component.OnDestroyConstruction(); } this.m_Destroying = true; GameObject prefab = GreenHellGame.Instance.GetPrefab(this.m_Info.m_ID.ToString() + "Ghost"); if (prefab && this.ReplIsOwner()) { foreach (GhostStep ghostStep in prefab.GetComponent <ConstructionGhost>().m_Steps) { foreach (GhostSlot ghostSlot in ghostStep.m_Slots) { if (!ghostSlot.m_ItemName.ToLower().Contains("mud") && UnityEngine.Random.Range(0f, 1f) < 0.5f) { Vector3 position = (this.m_Info.m_ID == ItemID.Campfire && ghostSlot.gameObject.GetComponent <BoxCollider>()) ? ghostSlot.gameObject.GetComponent <BoxCollider>().center : ghostSlot.transform.localPosition; ItemsManager.Get().CreateItem((ItemID)Enum.Parse(typeof(ItemID), ghostSlot.m_ItemName), true, base.transform.TransformPoint(position), Quaternion.identity); } } } } foreach (ConstructionSlot constructionSlot in this.m_ConstructionSlots) { if (constructionSlot.m_Construction && constructionSlot.m_DestroyWithSnapParent && constructionSlot.m_MatchingItemIDs.Contains(constructionSlot.m_Construction.GetInfoID())) { constructionSlot.m_Construction.DestroyMe(true); } } if (this.m_DestroyWithFrame && check_connected) { foreach (Construction construction2 in this.m_ConnectedConstructions) { ConstructionSlot[] constructionSlots = construction2.m_ConstructionSlots; for (int i = 0; i < constructionSlots.Length; i++) { if (constructionSlots[i].m_Construction == this) { construction2.DestroyMe(false); break; } } } } if (this.m_DestroyWithChilds) { foreach (ConstructionSlot constructionSlot2 in this.m_ConstructionSlots) { if (constructionSlot2.m_Construction) { constructionSlot2.m_Construction.DestroyMe(false); } } } if (this.m_DestroySounds.Count > 0) { GameObject gameObject = new GameObject(); OneShotSoundObject oneShotSoundObject = gameObject.AddComponent <OneShotSoundObject>(); gameObject.name = "OneShotSoundObject from Construction"; oneShotSoundObject.m_SoundNameWithPath = this.m_DestroySounds[UnityEngine.Random.Range(0, this.m_DestroySounds.Count)]; oneShotSoundObject.gameObject.transform.position = base.transform.position; } ConstructionGhostManager.Get().OnDestoryConstruction(this); ItemsManager.Get().m_WasConstructionDestroyed = true; this.OnDestroyConstruction(); if (!Replicator.IsAnyObjectBeingDeserialized()) { UnityEngine.Object.Destroy(base.gameObject); } }