private void Awake() { if (Instance == null) { Instance = this; } else { throw new UnityException("ElementSpawn.Instance!=null"); } }
// Start is called before the first frame update void Start() { spawnArea = GameObject.FindGameObjectWithTag("SpawnArea").GetComponent <ElementSpawn>(); spawnArea.elementReference.Add(this.gameObject); if (elementType == ElementEnum.Elements.None) { RandomType(); } rnd = new System.Random(Guid.NewGuid().GetHashCode()); angles[0] = (float)rnd.NextDouble(); angles[1] = (float)rnd.NextDouble(); angles[2] = (float)rnd.NextDouble(); rotationSpeed = 90; speed = 2f; source = GetComponent <AudioSource>(); }