//////////////////////////////////////////////////////////////// public void PopResetPlant(ResetPlantComponent resetPlant) { ResetPlantData data = m_ResetPlantData.Find((ResetPlantData rpd) => { return(rpd._ResetPlant.Equals(resetPlant)); }); if (data == null) { Debug.LogError("Could not find resetPlant-to-be-plopped in playerManager " + resetPlant.gameObject.name); return; } //////////////////////////////////////////////////////////////// resetPlant.TransitionToState(ResetPlantState.Destroyed, false); if (!data._Respawns) { // #destroySpawnedResetPlant GameObject.Destroy(data._ResetPlant.gameObject); m_ResetPlantData.Remove(data); } else { AssetDataEntities assetDataBlobs = AssetManager.GetAssetData <AssetDataEntities>(); data._PloppedTimer = assetDataBlobs.PloppedFor; } EventManager.Get().FireEvent(new PlaySoundEvent(Sounds.FX_SmallBlop, resetPlant.gameObject)); m_PlayerController.RegainDash(PlayerController.RegainDashContext.TemporaryReset); }
//////////////////////////////////////////////////////////////// public void PopBlob(BlobComponent blob) { int blobHiveIndex = -1; for (int i = 0; i < m_BlobHives.Count; i++) { if (!m_BlobHives[i]._Hive.Equals(blob.ParentBlobHive)) { continue; } blobHiveIndex = i; break; } if (blobHiveIndex == -1) { Debug.LogError("Could not find parent blob hive in playerManager for blob-to-be-plopped " + blob.gameObject.name); return; } BlobHiveData data = m_BlobHives[blobHiveIndex]; //////////////////////////////////////////////////////////////// AssetDataEntities assetDataBlobs = AssetManager.GetAssetData <AssetDataEntities>(); data._PloppedTimers[blob.ParentBlobInHiveID] = 10000; //< We dont want plops to regrow. // assetDataBlobs.PloppedFor; blob.TransitionToState(BlobState.Destroyed, false); EventManager.Get().FireEvent(new PlaySoundEvent(Sounds.FX_SmallBlop, blob.gameObject)); AssetDataCamera assetDataCamera = AssetManager.GetAssetData <AssetDataCamera>(); CameraManager.Get().AddTrauma(assetDataCamera.TraumaOnBlobPop); m_PlayerController.RegainDash(PlayerController.RegainDashContext.TemporaryReset); //////////////////////////////////////////////////////////////// // Check if the hive is now deactivated if (data._Hive.Deactivatebale) { bool deactiveBlobHive = true; for (int i = 0; i < data._PloppedTimers.Length; i++) { if (data._PloppedTimers[i] == 0) { deactiveBlobHive = false; break; } } if (deactiveBlobHive) { data._Active = false; data._Hive.SetRelatedObjectsActive(false); } } //////////////////////////////////////////////////////////////// m_BlobHives[blobHiveIndex] = data; }