public void MoveDoing(Tile targetTile, TweenCallback completeEvent) { moveTween.Kill(); moveOn = true; currentTile = targetTile; Vector2 curentPos = transform.transform.position; Vector2 targetPos = currentTile.transform.position; bool moveUpOn = curentPos.y < targetPos.y; bool moverightOn = curentPos.x < targetPos.x; CitizenAnimState animState = moveUpOn ? CitizenAnimState.Back : CitizenAnimState.Side; AnimReset(animState); Quaternion quaternion = moverightOn == true?Quaternion.Euler(0, 180, 0) : Quaternion.Euler(Vector3.zero); transform.rotation = quaternion; TileCheck(); moveTween = transform.DOMove(currentTile.transform.position, moveSpeed) .SetEase(Ease.Linear) .OnComplete(completeEvent); }
void AnimReset(CitizenAnimState animState) { this.animState = animState; bool stop = this.animState == CitizenAnimState.Stop; bool back = this.animState == CitizenAnimState.Back; bool side = this.animState == CitizenAnimState.Side; animator.SetBool("stop", stop); animator.SetBool("back", back); animator.SetBool("side", side); }