/** * Called at start */ void Start() { SpriteToHide = GetComponentsInChildren <SpriteRenderer>(); GetComponent <SpriteRenderer>().enabled = false; foreach (SpriteRenderer sprite in SpriteToHide) { sprite.enabled = false; } StartCoroutine("HidePop"); collider = GetComponent <CircleCollider2D>(); collider.enabled = false; StartCoroutine("SafePop"); music = GameObject.Find("MusicPlayer"); GameObject player = GameObject.FindWithTag("Player"); sphereController = player.transform.GetComponentInChildren <PlayerSphereController>(); animator = GetComponent <Animator>(); trail = GetComponent <TrailRenderer>(); if (MusicManager.WebGLBuildSupport) { MusicManager.PostEvent("Ennemy_Pop"); } else { #if !UNITY_WEBGL AkSoundEngine.PostEvent("Ennemy_Pop", music); #endif } tomateCounter = 0; moveComponent = GetComponent <MoveElliptic>(); PopparticleSystem = GetComponentsInChildren <ParticleSystem>()[0]; PopparticleSystem.GetComponent <Renderer>().sortingLayerName = "UI"; //PopparticleSystem.GetComponent<Renderer>(). .material.color = new Color(0.82f, 0.18f, 0.18f); if (moveComponent != null) { moveComponent.enabled = false; state = EEnemyState.WaitForMove; StartCoroutine(WaitForMove()); } else { state = EEnemyState.DoUntilDeath; } }
/** * Called once at start */ void Start() { sprite = this.GetComponent <SpriteRenderer>(); sprite.enabled = false; StartCoroutine("HidePop"); collider = GetComponent <PolygonCollider2D>(); collider.enabled = false; StartCoroutine("SafePop"); music = GameObject.Find("MusicPlayer"); BaseStart(); if (MusicManager.WebGLBuildSupport) { MusicManager.PostEvent("Ennemy_Pop"); } else { #if !UNITY_WEBGL AkSoundEngine.PostEvent("Ennemy_Pop", music); #endif } animator = this.GetComponent <Animator>(); animator.SetBool("LowLife", false); trail = GetComponent <TrailRenderer>(); moveComponent = GetComponent <MoveElliptic>(); initialHitPoint = hitPoint; particleSystem = GetComponentInChildren <ParticleSystem>(); particleSystem.GetComponent <Renderer>().sortingLayerName = "UI"; PopparticleSystem = GetComponentsInChildren <ParticleSystem>()[1]; PopparticleSystem.GetComponent <Renderer>().sortingLayerName = "UI"; PopparticleSystem.GetComponent <Renderer>().material.color = new Color(0.82f, 0.18f, 0.18f); PopparticleSystem.Play(); }