using UnityEngine; using System.Collections; private IEnumerator Teleporter() { this.playerCollider.enabled = false; int teleports = UnityEngine.Random.Range(7, 14); int teleportCount = 0; float baseTime = 0.3f; float currentTime = baseTime; float increaseFactor = 1.1f; while (teleportCount < teleports) { currentTime -= Time.deltaTime; if (currentTime < 0f) { this.Teleport(); teleportCount++; baseTime *= increaseFactor; currentTime = baseTime; } this.player.height = 4f; yield return null; } this.playerCollider.enabled = true; yield break; } private void Teleport() { this.AILocationSelector.GetNewTarget(); this.player.transform.position = this.AILocationSelector.transform.position + Vector3.up * this.player.height; this.audioDevice.PlayOneShot(this.aud_Teleport); }