public void Update() { if (currentStatus == Status.Rest) { return; } else if (currentStatus == Status.PrepareAttack) { if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) { UpdateAttackTarget(); if (validAttackTarget && (hexMap.IsReachable(getCurrentPointerCell()) || hexMap.IsReachable(getCurrentPointerPawn().currentCell))) { Attack(); } else { OnCancel(); } } } else if (currentStatus == Status.PrepareMove) { if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) { UpdateRoute(); if (!validRoute || !hexMap.IsReachable(getCurrentPointerCell())) { OnCancel(); } else { routes = hexMap.GetCurrentRoutes(); currentTarget = 0; Move(); } } } else if (currentStatus == Status.IsMoving) { selectedPawn.transform.position = Vector3.Lerp(selectedPawn.transform.position, routes[currentTarget].transform.position, Time.deltaTime * moveSpeed); float distance = Vector3.Distance(selectedPawn.transform.position, routes[currentTarget].transform.position); if (distance < 0.01f) { hexMap.RevealCellsFrom(routes[currentTarget]); if (currentTarget < routes.Count - 1) { currentTarget++; } else { ClearStatus(); } } } else if (currentStatus == Status.IsAttacking) { //Debug.Log("Showing attack animation"); ClearStatus(); } else if (currentStatus == Status.IsTransfering) { //Debug.Log("transfering"); selectedPawn.transform.position = selectedPawn.currentCell.transform.position; ClearStatus(); } else if (currentStatus == Status.PrepareDoSkill) { if (requirePawnSelection) { if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) { UpdateSkillTarget(); if (validSkillTarget) { DoSkill(); } else { attackPanel.OnCancel(); } } } else if (requireCellSelection) { if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) { UpdateSkillTarget(); if (validSkillTarget) { DoSkill(); } else { attackPanel.OnCancel(); } } } else { currentStatus = Status.IsDoSkill; } } else if (currentStatus == Status.IsDoSkill) { DoSkill(); } }