void Update() { currentTile = board.WorldSpaceToTile(transform.position); if (actionEnabled) { /* * if(CharacterAction.Action(actionCommand)); * { * actionEnabled = false; * controller.currentCommand = 'I'; * } */ } else if (destination) { // Move to destination //// Idle //// if (agent.remainingDistance <= agent.stoppingDistance) { if (!agent.hasPath || agent.velocity.sqrMagnitude == 0f) { // Agent has reached destination. Set to false and set idle animation. animator.SetBool("Run", false); destination = false; } } //// Moving //// else if (!animator.GetBool("Run")) { // A destination is set and agent is moving. Set animation to running. animator.SetBool("Run", true); } } else if (basicAttackEnabled && action.BasicAttackAvailable) { action.ActionBasicAttack(); } else if (autoAttackEnabled) { if (!destination && !action.Attacking && action.BasicAttackAvailable) { action.ActionAutoAttack(); } } if (currentTile != lastTile) { if (lastTile) { lastTile.GetComponent <Hex>().RemovePlayer(this.gameObject); } currentTile.GetComponent <Hex>().AddPlayer(this.gameObject); lastTile = currentTile; } lastTile = currentTile; }