/// <summary> /// /// </summary> /// <param name="processIndex"></param> private void Sequence(int processIndex) { // get the timer from the thread float newTimer = mTimers.at(processIndex); // add time to timer newTimer += Time.deltaTime; // check if we can shoot or not if (mTimePerShoot < newTimer) { int totalShootCount = mShootCount.at(processIndex); int currentShootCount = mShootCounter.at(processIndex); if (currentShootCount == totalShootCount) { // Remove Thread. EndProcessSequence(processIndex); return; } Vector3 spawnPos = this.transform.position; Vector3 shootAngle = this.mShootAction.SpawnPoint.eulerAngles; // if stay in the same position if (mSequenceStay) { spawnPos = mShootPos.at(processIndex); } if (mShootGapEffect) { spawnPos.y += currentShootCount * mShootGap; } if (mKeepShootAngle) { shootAngle = mShootAngles.at(processIndex); } // do shooting mShootAction.ShootWithShootCount(spawnPos, shootAngle); ++currentShootCount; // update new count, in order // to spawn next bullet mShootCounter.set(processIndex, currentShootCount); newTimer = 0; } // update timer mTimers.set(processIndex, newTimer); }