// Start is called before the first frame update void Start() { currentIndex = 0; currentSkill = player.GetComponent <BattleTestPlayer>().skills[currentIndex]; MoveIndicator(new Vector2Int(currentIndex % 2, (currentIndex - minRenderedIndex) / 2)); RenderMenuItems(currentIndex); turn = GameObject.FindGameObjectWithTag("Box").GetComponent <TurnSystem>(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.RightArrow)) { if (Input.GetKeyDown(KeyCode.UpArrow) && currentIndex - 2 >= 0) { currentIndex -= 2; } else if (Input.GetKeyDown(KeyCode.RightArrow) && currentIndex % 2 == 0 && currentIndex + 1 < player.GetComponent <BattleTestPlayer>().skills.Count) { currentIndex += 1; } else if (Input.GetKeyDown(KeyCode.DownArrow) && currentIndex + 2 < player.GetComponent <BattleTestPlayer>().skills.Count) { currentIndex += 2; } else if (Input.GetKeyDown(KeyCode.LeftArrow) && currentIndex % 2 == 1) { currentIndex -= 1; } currentSkill = player.GetComponent <BattleTestPlayer>().skills[currentIndex]; if (currentIndex > maxRenderedIndex) { if (currentIndex % 2 == 0) { RenderMenuItems(currentIndex - 2); } else if (currentIndex % 2 == 1) { RenderMenuItems(currentIndex - 3); } } else if (currentIndex < minRenderedIndex) { if (currentIndex % 2 == 0) { RenderMenuItems(currentIndex); } else if (currentIndex % 2 == 1) { RenderMenuItems(currentIndex - 1); } } indpos.x = currentIndex % 2; indpos.y = (currentIndex - minRenderedIndex) / 2; MoveIndicator(indpos); } /*if(Input.GetKeyDown(KeyCode.Return) && turn.state == TurnSystem.State.Awaiting) * { * Attacks k = player.GetComponent<Attacks>(); * k.Invoke(currentSkill.name, 0); * }*/ }