IEnumerator Start() { sound = GetComponent <GolenSoundController>(); anim = gameObject.GetComponent <Animator>(); golen_atack = GetComponent <Golen_atack>(); sound.playRoarSound(false); yield return(new WaitForSeconds(2f)); anim.SetTrigger("Walk"); sound.playWalkSound(true); is_alive = true; GetComponent <GolenMoviment>().enabled = true; }
//public bool is_start_magic = false; IEnumerator Start() { atk_scope_anim = GetComponent <Animation>(); sound = GetComponent <GolenSoundController>(); player = GameObject.FindGameObjectWithTag("player_damage").GetComponent <PlayerDamage>(); while (true) { if (currentGesture == "CLOSE") { // Debug.Log("Starting Magic"); sound.playRoarSound(false); StartCoroutine(StartMagic()); hand_magic_atack.SetActive(true); yield return(new WaitForSeconds(5f)); hand_magic_atack.SetActive(false); StopCoroutine(StartMagic()); sound.stopRoarSound(false); // Debug.Log("Ending_Magic"); } /* * if (currentGesture == "THUMB") * { * Debug.Log("Starting Defense"); * hand_magic_defense.SetActive(true); * StartCoroutine(StartDefense()); * yield return new WaitForSeconds(5f); * hand_magic_defense.SetActive(false); * StopCoroutine(StartDefense()); * Debug.Log("Ending_Defense"); * } */ stateMachine = currentGesture; yield return(new WaitForSeconds(.2F)); } IEnumerator StartMagic() { while (true) { string secont_gesture = currentGesture; if (secont_gesture == "OPEN") { hand_magic_atack.SetActive(false); sound.stopRoarSound(false); sound.playAtackSound(false); //Debug.Log("Shooting"); Instantiate_Prefab(fireball, right_scope.transform.position); // Debug.Log("BOLA DE FOGO, METEOOOORO"); //yield return new WaitForSeconds(.5f); break; } if (secont_gesture == "LOVE") { hand_magic_atack.SetActive(false); defense_fire.SetActive(true); sound.stopRoarSound(false); sound.playAtackSound(false); yield return(new WaitForSeconds(2f)); defense_fire.SetActive(false); break; } yield return(new WaitForSeconds(.1f)); } } }