private void Awake() { screenCenter = new Vector3(Screen.width / 2, Screen.height / 2, 0); raycastLayerMask = LayerMask.GetMask("Map", "Player"); bulletInMagazine = magazineCapacity; bulletPool = ObjectPoolManager.INSTANCE.GetObjectPool(bulletPrefab, magazineCapacity + 10, false); effectiveRange = bulletSpeed * bulletLifeTime; int strategyCount = 0; strategyCount += singleShootMode ? 1 : 0; strategyCount += burstShootMode ? 1 : 0; shootStrategies = new IShootStrategy[strategyCount]; int index = 0; if (singleShootMode) { shootStrategies[index++] = new SingleShootStrategy(this, singleShootInterval); } if (burstShootMode) { shootStrategies[index++] = new BurstShootStrategy(this, intervalBetweenBurst, intervalBetweenShoot, bulletShootInSingleBurst); } strategyUsingIndex = 0; }
private void Awake() { if (INSTANCE != null) { Destroy(this); return; } INSTANCE = this; pool = new ObjectPoolManager.ObjectPool(prefab, capacity, true, gameObject); }