public void OnEnterCamera() { int qt = Random.Range(0, zapperPlaceHolders.Length) + 1; for (int i = 0; i < qt; i++) { ZapperPlaceHolder placeholder = zapperPlaceHolders [Random.Range(0, zapperPlaceHolders.Length)]; if (!placeholder.used) { placeholder.used = true; Zapper newZapper = ZapperManager.GetInstance().CreateZapperAt(placeholder.transform.position); this.zappers.Add(newZapper); } } }
public void OnLeaveCamera() { if (this.zappers != null) { for (int i = 0; i < this.zappers.Count; i++) { Destroy(zappers[i].gameObject); this.zappers.Remove(this.zappers[i]); } for (int i = 0; i < this.zapperPlaceHolders.Length; i++) { ZapperPlaceHolder placeholder = zapperPlaceHolders [Random.Range(0, zapperPlaceHolders.Length)]; placeholder.used = false; } } }
private void CreateZapper() { int zapperCount = Random.Range(0, (this.zapperPlaceHolders.Length + 1)); this.cont++; for (int i = 0; i < zapperCount; i++) { int zapperIndex = Random.Range(0, this.zapperPlaceHolders.Length); ZapperPlaceHolder placeHolder = this.zapperPlaceHolders [zapperIndex]; if (!placeHolder.wasUsed) { placeHolder.wasUsed = true; Vector3 placeHolderPosition = placeHolder.transform.position; Zapper newZapper = ZapperManager.GetIntance().CreateZapperAt(placeHolderPosition); zappers.Add(newZapper); //newZapper.transform.SetParent (this.transform, false); } } }