// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (possible == null) { possible = ms.GetPossible(creature.movementLeft); } if (!ms.notMoving) { possible = ms.GetPossible(creature.movementLeft); } else if (possible != null) { ms.ShowPossible(possible); } brain.outline.OutlineColor = Color.blue; Ray ray = brain.cam.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100, brain.tileMapLayerMask)) { Tile endTile = hit.collider.GetComponent <Tile>(); brain.tileIndictor.transform.position = endTile.GetCenterOfTile(); if (endTile.unitOnTile == null && Input.GetButtonDown("Fire1") && possible != null) { bool a = false; foreach (Tile tile in possible) { if (endTile == tile) { a = true; } } if (a) { if (EventSystem.current.IsPointerOverGameObject()) { return; } ms.Move(endTile, true); } } } if (brain.HasActionLeft()) { if (abilitySelector.currentlySelectedNum > 0) { if (ms.finishedMoving) { animator.SetInteger("Ability", abilitySelector.currentlySelectedNum - 1); animator.SetBool("UseAbility", true); abilitySelector.ResetAbilitySelection(-1); ms.finishedMoving = false; } } } if (Input.GetButtonDown("Next")) { brain.isMyTurn = false; } }