public void SetParent(TilemapCircle parent, FollowParentParameters followParameters, Vector2 position, float rotation) { this.parent = parent; this.position = position; this.rotation = rotation; this.parentFollowScale = (followParameters & FollowParentParameters.FollowScale) != 0; this.parentFollowRotation = (followParameters & FollowParentParameters.FollowRotation) != 0; this.parentCheckCollisions = (followParameters & FollowParentParameters.CheckCollisions) != 0; if (parent != null) { if (parentFollowScale) { this.scale = parent.GetScaleFromPosition(position); } if (parentFollowRotation) { this.rotation = parent.GetAngleFromPosition(position); } distanceInTilemapCircle = parent.GetDistanceFromPosition(position); angleInTilemapCirclePosition = parent.GetAngleFromPosition(position); } if (listener != null) { listener.OnParentChanged(parent); } }
public void Init(Vector2 size, TilemapCircle parent, FollowParentParameters followParameters, Vector2 position, float rotation) { this.size = size; SetParent(parent, followParameters, position, rotation); }