private DigParticles SpawnDigParticles(Vector3 position, float intensity) { GameObject digParticlesObj = Object.Instantiate(this.digParticlesPrefab, position, Quaternion.identity); DigParticles digParticles = digParticlesObj.GetComponent <DigParticles>(); digParticles.SetIntensity(intensity); return(digParticles); }
IEnumerator State_DigOut() { var holeEntry = this.GetRandomHoleEntry(); this.TeleportToHoleEntry(holeEntry); this.digParticles = this.SpawnDigParticles(holeEntry.position, 0.1f); yield return(new WaitForSeconds(2)); this.digParticles.SetIntensity(0.3f); this.musicController.PlayDigOut(); yield return(new WaitForSeconds(2.5f)); this.digParticles.SetIntensity(1); yield return(new WaitForSeconds(2)); this.digParticles.Remove(); this.model.gameObject.SetActive(true); this.hitboxCollider.enabled = true; // Next state if (Random.Range(0, 1) == 0) { this.SetState(State.Attack1); } else { for (float i = 0; i < 1; i += Time.deltaTime) { this.model.transform.localPosition = new Vector3(0, -1.15f + i * (1.15f - 0.65f), 0); yield return(new WaitForEndOfFrame()); } this.model.transform.localPosition = new Vector3(0, -0.65f, 0); this.SetState(State.IdleOutside); } }