| | 1 | | using System; |
| | 2 | | using System.Collections; |
| | 3 | | using System.Collections.Generic; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | namespace DCL.Skybox |
| | 7 | | { |
| | 8 | | [System.Serializable] |
| | 9 | | public class Config3DPlanar |
| | 10 | | { |
| 0 | 11 | | public bool enabled = true; |
| | 12 | | public string nameInEditor; |
| | 13 | | public LayerRenderType renderType; |
| | 14 | | public GameObject prefab; |
| | 15 | | public float timeSpan_start = 0; |
| 0 | 16 | | public float timeSpan_End = 24; |
| | 17 | | public float fadeInTime = 0; |
| | 18 | | public float fadeOutTime = 0; |
| | 19 | | public float satelliteSize; |
| | 20 | | public float radius; |
| | 21 | | public float yPos = 0; |
| | 22 | | public bool followCamera; |
| | 23 | | public bool renderWithMainCamera; |
| | 24 | | public bool validPrefab; |
| | 25 | |
|
| | 26 | | private ParticleSystem particles; |
| 0 | 27 | | [NonSerialized] public string inValidStr = ""; |
| | 28 | |
|
| 0 | 29 | | public Config3DPlanar(string name) { this.nameInEditor = name; } |
| | 30 | |
|
| | 31 | | public void AssignNewPrefab(GameObject tempPrefab) |
| | 32 | | { |
| 0 | 33 | | if (tempPrefab == prefab) |
| | 34 | | { |
| 0 | 35 | | return; |
| | 36 | | } |
| | 37 | |
|
| 0 | 38 | | if (tempPrefab == null) |
| | 39 | | { |
| 0 | 40 | | prefab = tempPrefab; |
| 0 | 41 | | return; |
| | 42 | | } |
| | 43 | |
|
| | 44 | | // Check if prefab contains particle system |
| 0 | 45 | | particles = tempPrefab.GetComponent<ParticleSystem>(); |
| 0 | 46 | | if (particles == null) |
| | 47 | | { |
| 0 | 48 | | validPrefab = false; |
| 0 | 49 | | inValidStr = "Particle system not present"; |
| 0 | 50 | | } |
| | 51 | | else |
| | 52 | | { |
| | 53 | | // Check if particle system is of type circle |
| 0 | 54 | | var shape = particles.shape; |
| 0 | 55 | | if (shape.shapeType == ParticleSystemShapeType.Circle || shape.shapeType == ParticleSystemShapeType.Hemi |
| | 56 | | { |
| 0 | 57 | | validPrefab = true; |
| 0 | 58 | | radius = shape.radius; |
| 0 | 59 | | prefab = tempPrefab; |
| 0 | 60 | | inValidStr = "valid!"; |
| 0 | 61 | | } |
| | 62 | | else |
| | 63 | | { |
| 0 | 64 | | validPrefab = false; |
| 0 | 65 | | inValidStr = "Particle system not of type Circle or Hemisphere"; |
| | 66 | | } |
| | 67 | |
|
| | 68 | | } |
| 0 | 69 | | } |
| | 70 | | } |
| | 71 | | } |