Пример #1
0
 private Quaternion RotationOf(Entity entity)
 {
     var direction = entity.DirectionFrom(transform.position);
     var angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
     return Quaternion.AngleAxis(angle, Vector3.forward);
 }
Пример #2
0
 private Vector2 PositionOf(Entity entity)
 {
     Vector2 position = transform.position;
     return position + entity.DistanceTo(position) * entity.DirectionFrom(position);
 }