private IEnumerator Turn(PlayerEntityView entityView, HexDirection dir) { var moveComp = entityView.movementComponent; moveComp.isWalking = false; var id = moveComp.rotate(dir.ToEuler()); while (LeanTween.isTweening(id)) { yield return(null); } }
public void Match() { transform.localPosition = Cell.transform.position; transform.localEulerAngles = direction.ToEuler(); }
public virtual IEnumerator Turn(HexDirection dir) { anim.Walking = false; TransformLocalEulerTweener t = (TransformLocalEulerTweener)transform.RotateToLocal(dir.ToEuler(), 0.25f, EasingEquations.EaseInOutQuad); // When rotating between North and West, we must make an exception so it looks like the unit // rotates the most efficient way (since 0 and 360 are treated the same) if (Mathf.Approximately(t.startTweenValue.y, 0f) && Mathf.Approximately(t.endTweenValue.y, 270f)) { t.startTweenValue = new Vector3(t.startTweenValue.x, 360f, t.startTweenValue.z); } else if (Mathf.Approximately(t.startTweenValue.y, 270) && Mathf.Approximately(t.endTweenValue.y, 0)) { t.endTweenValue = new Vector3(t.startTweenValue.x, 360f, t.startTweenValue.z); } unit.direction = dir; while (t != null) { yield return(null); } }