protected override IEnumerator Burst(int quantity, float timeInSeconds, BurstType burstType) { if (quantity <= 0) { yield break; } float rate = timeInSeconds / quantity; WaitForSeconds waitingTime = new WaitForSeconds(rate); int nbSpawned = 0; while (nbSpawned < quantity) { MineType type; switch (burstType) { case BurstType.BlueMine: type = MineType.Blue; break; case BurstType.RedMine: type = MineType.Red; break; default: type = (Random.value > .5f) ? MineType.Blue : MineType.Red; break; } SpawnMine(type, levelSettings.mineMinSize, levelSettings.mineMaxSize, levelSettings.mineMinSpeed, levelSettings.mineMaxSpeed); nbSpawned++; yield return(waitingTime); } }
protected override IEnumerator Burst(int quantity, float timeInSeconds, BurstType burstType) { if (quantity <= 0) { yield break; } Vector3 pos; GameObject coin; CoinController ctrlr; float rate = timeInSeconds / quantity; WaitForSeconds waitingTime = new WaitForSeconds(rate); int nbSpawned = 0; while (nbSpawned < quantity) { pos = transform.position; pos.x = Random.Range(minPosX, maxPosX); coin = Instantiate(standardCoinPrefab, pos, Quaternion.identity); ctrlr = coin.GetComponent <CoinController>(); ctrlr.coinSoundCtrlr = coinSoundCtrlr; ctrlr.cam = cam; ctrlr.coinIndicator = coinIndicator; ctrlr.coinIndicatorAnim = coinIndicatorAnim; nbSpawned++; yield return(waitingTime); } }
public SpawningBurst(float score, BurstType type, int quantity, float time) { this.type = type; this.score = score; this.quantity = quantity; this.time = time; }
// Get amount list public static void SetDustFinalAmount(List <RayfireDust> targets, BurstType burstType, int burstAmount) { // No burst if (burstType == BurstType.None) { for (int i = 0; i < targets.Count; i++) { targets[i].amountFinal = 0; } } // Same burst amount for every fragment if (burstType == BurstType.FragmentAmount) { for (int i = 0; i < targets.Count; i++) { targets[i].amountFinal = burstAmount; } } // Burst amount per particles per fragment size else if (burstType == BurstType.PerOneUnitSize) { for (int i = 0; i < targets.Count; i++) { targets[i].amountFinal = (int)(burstAmount * targets[i].rigid.limitations.bboxSize); } } // Burst amount by total amount divided among hosts by their amount and size else if (burstType == BurstType.TotalAmount) { // Get sum of all sizes float totalSize = 0f; for (int i = 0; i < targets.Count; i++) { totalSize += targets[i].rigid.limitations.bboxSize; } // Get size per particle float sizePerParticle = totalSize / burstAmount; // Get size for every host by it's size for (int i = 0; i < targets.Count; i++) { targets[i].amountFinal = (int)(targets[i].rigid.limitations.bboxSize / sizePerParticle); } } }
protected override IEnumerator Burst(int quantity, float timeInSeconds, BurstType burstType) { if (quantity <= 0) { yield break; } float rate = timeInSeconds / quantity; WaitForSeconds waitingTime = new WaitForSeconds(rate); int nbSpawned = 0; while (nbSpawned < quantity) { SpawnOne(levelSettings.rockMinSize, levelSettings.rockMaxSize, levelSettings.rockMinSpeed, levelSettings.rockMaxSpeed); nbSpawned++; yield return(waitingTime); } }
protected override IEnumerator Burst(int quantity, float timeInSeconds, BurstType burstType) { if (quantity <= 0) { yield break; } float rate = timeInSeconds / quantity; WaitForSeconds waitingTime = new WaitForSeconds(rate); int nbSpawned = 0; GameObject prefab = burstType == BurstType.Bottle ? plasticBottlePrefab : null; while (nbSpawned < quantity) { SpawnOne(prefab); nbSpawned++; yield return(waitingTime); } }
protected override IEnumerator Burst(int quantity, float timeInSeconds, BurstType burstType) { if (quantity <= 0) { yield break; } float rate = timeInSeconds / quantity; WaitForSeconds waitingTime = new WaitForSeconds(rate); int nbSpawned = 0; while (nbSpawned < quantity) { switch (burstType) { case BurstType.BlueBubble: SpawnBlueBubble(); break; case BurstType.RedBubble: SpawnRedBubble(); break; default: if (Random.value > .5f) { SpawnBlueBubble(); } else { SpawnRedBubble(); } break; } nbSpawned++; yield return(waitingTime); } }
public override void StartBurst(int quantity, float timeInSeconds, BurstType burstType) { StartCoroutine(Burst(quantity, timeInSeconds, burstType)); }
protected abstract IEnumerator Burst(int quantity, float timeInSeconds, BurstType burstType);