private MineMeteorMovement.Path getRandomMineMeteorPath(bool tutorial = false) { var paths = tutorial ? tutorialMineMeteorPaths : mineMeteorPaths; Debug.Assert(paths.Count > 0); var random = RandomHelper.Instance(); var pathParams = random.GetItem(paths); var path = new MineMeteorMovement.Path(); path.spawnPoint = random.GetItem(pathParams.spawnPoints); do { path.holdPoint = random.GetItem(pathParams.holdPoints); }while (path.holdPoint.IsOccupied); path.destinationPoint = random.GetItem(pathParams.destinationPoints); path.speed = pathParams.speed.GetRandom(); path.holdDuration = pathParams.holdDuration.GetRandom(); return(path); }
private MineMeteorMovement SpawnMineMeteor(MineMeteorMovement.Path path) { var pos = path.spawnPoint.transform.position; pos.z = minerMeteorPrefab.transform.position.z; var meteor = Instantiate(minerMeteorPrefab, pos, Quaternion.identity, meteorHolder.transform); var meteorMovement = meteor.GetComponent <MineMeteorMovement>(); Debug.Assert(meteorMovement); meteorMovement.SetPath(path); var mineMeteor = meteor.GetComponent <mine_meteor>(); Debug.Assert(mineMeteor); var mul = GetReverseDifficultyCoefficient(miningCapacityMulMin, miningCapacityMulMax, miningCapacityDifficultyCoeff); Debug.Log(String.Format("Distance {0}, mult {1}", gameHandler.GetDistance(), mul)); mineMeteor.SetMineMultiplier(mul); return(meteorMovement); }