private void OnDestroy() { if (instance == this) { bulletDictionary = null; instance = null; } }
private string GetCurrentBulletTag(BulletArray ba, int elapsedFrames) { int tagIndex = 0; if (ba.bulletTypeDuration != 0) { tagIndex = (elapsedFrames / ba.bulletTypeDuration) % ba.bulletTags.Count; } return(ba.bulletTags[tagIndex]); }
private void OnEnable() { if (instance == null) { instance = this; bulletDictionary = new Dictionary <string, GameObject>(); DictIO(); } else { Debug.LogWarning("There should only be one BulletArray Asset in the project!"); DestroyImmediate(this); } }
// Start is called before the first frame update void Start() { BulletArray bulletArray = BulletArray.instance; bulletArray.DictIO(); bulletDictionary = new Dictionary <string, Queue <GameObject> >(); dummy = new GameObject(); foreach (Bullet bullet in bulletArray.enemies) { Queue <GameObject> bulletPool = new Queue <GameObject>(); for (int i = 0; i < bullet.size; i++) { GameObject newBulet = Instantiate(bullet.gameObject); newBulet.name = bullet.name; newBulet.SetActive(false); bulletPool.Enqueue(newBulet); } bulletDictionary.Add(bullet.name, bulletPool); } }
private void OnDisable() { BulletArray Inspecting = (BulletArray)target; Inspecting.DictIO(); }