// Use this for initialization void Start() { // Preload bullet for later use poolManager.PreloadBulletByID(0, 1000); poolManager.PreloadBulletByID(1, 1000); // Start the main coroutine StartCoroutine(MainCoroutine()); }
// Use this for initialization void Start() { //LeanTween.init (10000); var mousePos = Input.mousePosition; mousePos.z = 10; // select distance = 10 units from the camera mouseBullet.GetComponentInChildren <SpriteRenderer> ().color = Color.green; mouseBullet.GetComponentInChildren <UTargetCollider> ().SetEnable(true); regionTrigger.AddTriggerCallback((UBulletCollider ubc) => { ubc.GetObject().Recycle(); }); monitor.AddTargetCollider(mouseBullet.GetComponentInChildren <UTargetCollider>()); monitor.AddBulletRegionTrigger(regionTrigger); poolManager.PreloadBulletByID(0, 10000); poolManager.PreloadBulletByID(1, 10000); StartCoroutine(ShootCoroutine()); }
// Use this for initialization void Start() { var mousePos = Input.mousePosition; mousePos.z = 10; // select distance = 10 units from the camera mouseBullet.GetComponentInChildren <SpriteRenderer> ().color = Color.green; mouseBullet.GetComponentInChildren <UTargetCollider> ().SetEnable(true); regionTrigger.AddTriggerCallback((UBulletCollider ubc) => { ubc.trans.DOKill(); ubc.GetObject().Recycle(); }); monitor.AddTargetCollider(mouseBullet.GetComponentInChildren <UTargetCollider>()); monitor.AddBulletRegionTrigger(regionTrigger); shooter.transform.DOMove(new Vector3(Random.Range(-5f, 5f), Random.Range(-6f, 6f), 0f), 5f).SetEase(Ease.Linear).SetLoops(-1, LoopType.Yoyo); poolManager.PreloadBulletByID(0, 100); poolManager.PreloadBulletByID(1, 100); StartCoroutine(ShootCoroutine()); }