void StartNavigationState() { state = GameControllerState.Navigation; chc.winGame(); chc.transform.parent.gameObject.SetActive(false); //disable allys //disable enemies navScene.gameObject.SetActive(true); navPlayer.gameObject.SetActive(true); audioMan.PlayNavMusic(); }
/* * Funcion llamada cuando acaba el turno actual * */ public static void endTurn() { if (allies.Count == 0) { HUD.gameOver(); } else if (enemies.Count == 0) { HUD.winGame(); for (int i = 0; i < allies.Count; ++i) { allies[i].GetComponent <Animator> ().SetTrigger("Win"); } } else { //Desplazamos el array de turnos int count = 0; int dist = 0; for (int i = 1; (i < turns.Length) && (count < units.Count); ++i) { if (turns [i] != null) { ++count; if (dist == 0) { dist = i; } turns [i - dist] = turns [i]; turns[i] = null; HUD.addTimelineImage(turns [i - dist].GetComponent <_Stats>().icon, (i - dist)); HUD.addTimelineImage(null, i); } } GameObject t = turns[0]; _Stats s = t.GetComponent <_Stats> (); s.armor = 0f; if (s.preparingSkill) { //TODO: lanzar accion turns [0].GetComponent <Animator> ().SetTrigger(s.nextSkillTrigger); //esta llamara attack y endTurn s.nextSkill = null; s.preparingSkill = false; s.nextTarget = null; s.nextSkillTrigger = ""; int pos = Mathf.CeilToInt(s.speed * (1f + s.speed * 0.1f)); placeTurn(turns[0], s, pos); turns[0] = null; } else if (s.team == Team.Enemy) { //TODO: IA del enemigo (random) startAction(allies[UnityEngine.Random.Range(0, allies.Count)], s.setSkills[UnityEngine.Random.Range(0, s.setSkills.Length)]); } else { //TODO: habilitar control del jugador HUD.updateHUD(); HUD.setUserActive(true); } } }