private void SpawnStartingWalls(SongData songData) { BeatData data = songData.beatsData[0]; if (songData.beatsData.Length > gameConfig.numberOfWallsSpawnedAheadOfPlayer) { for (int i = 1; i < gameConfig.numberOfWallsSpawnedAheadOfPlayer; i++) { beatsAfterWallCreated++; if (/*i % 2 == 0 &&*/ beatsAfterWallCreated != gameConfig.beatsBeforeJump + 1 && beatsAfterWallCreated != 1 && beatsAfterWallCreated != 0) { float xPos = target.position.x + (data.GetTimeToFollowingBeat(data, i) * gameConfig.playerSpeedOnDoTween); float randomZ = UnityEngine.Random.Range(-gameConfig.randomizedRangeForXPositionObstacles, gameConfig.randomizedRangeForXPositionObstacles); Vector3 circlePos = new Vector3(xPos - 0f, -7.15f, target.position.z + randomZ); GameObject newCircle = Instantiate(circlePrefab, circlePos, Quaternion.identity); NW.Game.EventsProvider.onCircleSpawn?.Invoke(newCircle); } if (beatsAfterWallCreated == gameConfig.beatsBeforeJump + 1) { beatsAfterWallCreated = 0; } if (beatsAfterWallCreated == 2 && 1 != 2) { float randomZ = UnityEngine.Random.Range(-gameConfig.randomizedRangeForXPositionObstacles, gameConfig.randomizedRangeForXPositionObstacles); float getSomething = data.GetTimeToFollowingBeat(data, gameConfig.numberOfWallsSpawnedAheadOfPlayer) - data.GetTimeToFollowingBeat(data, gameConfig.numberOfWallsSpawnedAheadOfPlayer - 1); float xPos = target.position.x + ((data.GetTimeToFollowingBeat(data, i) - (getSomething * 1f)) * gameConfig.playerSpeedOnDoTween); Vector3 wallPos = new Vector3(xPos - 0f, 0f, target.position.z + randomZ); GameObject newWall = Instantiate(wallPrefab, wallPos, Quaternion.identity); NW.Game.EventsProvider.onWallSpawn?.Invoke(newWall); } } } }
private void SpawnWallIfAble(BeatData beatData) { float randomZ = UnityEngine.Random.Range(-gameConfig.randomizedRangeForXPositionObstacles, gameConfig.randomizedRangeForXPositionObstacles); beatsAfterWallCreated = 0; float getSomething = beatData.GetTimeToFollowingBeat(beatData, gameConfig.numberOfWallsSpawnedAheadOfPlayer) - beatData.GetTimeToFollowingBeat(beatData, gameConfig.numberOfWallsSpawnedAheadOfPlayer - 1); float xPos = target.position.x + ((beatData.GetTimeToFollowingBeat(beatData, gameConfig.numberOfWallsSpawnedAheadOfPlayer) - (getSomething * 1f)) * gameConfig.playerSpeedOnDoTween); Vector3 wallPos = new Vector3(xPos - 20f, 0f, playerStartingPosition.z + randomZ); GameObject newWall = Instantiate(wallPrefab, wallPos, Quaternion.identity); NW.Game.EventsProvider.onWallSpawn?.Invoke(newWall); }
private void SpawnWallIfAble(BeatData beatData) { float xPos = target.position.x + (beatData.GetTimeToFollowingBeat(beatData, gameConfig.numberOfWallsSpawnedAheadOfPlayer) * gameConfig.playerSpeedOnDoTween); Vector3 wallPos = new Vector3(xPos - 20f, 0f, target.position.z); Instantiate(wallPrefab, wallPos, Quaternion.identity); }
private void SpawnCircleIfAble(BeatData beatData) { beatAfterCircleCreated = 0; float xPos = target.position.x + (beatData.GetTimeToFollowingBeat(beatData, gameConfig.numberOfWallsSpawnedAheadOfPlayer) * gameConfig.playerSpeedOnDoTween); Vector3 circlePos = new Vector3(xPos - 20f, -7.15f, target.position.z); Instantiate(circlePrefab, circlePos, Quaternion.identity); }
private void SpawnCircleIfAble(BeatData beatData) { float randomZ = UnityEngine.Random.Range(-gameConfig.randomizedRangeForXPositionObstacles, gameConfig.randomizedRangeForXPositionObstacles); float xPos = target.position.x + ((beatData.GetTimeToFollowingBeat(beatData, gameConfig.numberOfWallsSpawnedAheadOfPlayer)) * gameConfig.playerSpeedOnDoTween); Vector3 circlePos = new Vector3(xPos - 20f, -7.15f, playerStartingPosition.z + randomZ); GameObject newCircle = Instantiate(circlePrefab, circlePos, Quaternion.identity); NW.Game.EventsProvider.onCircleSpawn?.Invoke(newCircle); }
public IEnumerator BeatActionDelay(BeatData beatData) { yield return(new WaitForSeconds(rhythmizationConfig.GetMusicDelay)); FireInvokeIfAble(); beatAfterJumpId++; onBeat?.Invoke(beatData); if (beatAfterJumpId == gameConfig.beatsBeforeJump + gameConfig.beatsDuringJump) { beatAfterJumpId = 0; List <float> jumps = new List <float>(); for (int i = 0; i < gameConfig.beatsDuringJump + 1; i++) { jumps.Add(beatData.GetTimeToFollowingBeat(beatData, i)); } NW.Game.EventsProvider.onJump?.Invoke(beatData.GetTimeToFollowingBeat(beatData, gameConfig.beatsDuringJump) * 0.49f); NW.Game.EventsProvider.onJumps?.Invoke(jumps.ToArray()); } }
private void ManageOnBeat(BeatData beatData) { float newPos = myEntityTransform.position.x + (beatData.GetTimeToFollowingBeat(beatData, 1) * gameConfig.playerSpeedOnDoTween); MoveMe(newPos, gameConfig.playerSpeedOnDoTween / gameConfig.playerSpeedOnDoTween * beatData.GetTimeToFollowingBeat(beatData, 1)); }