protected override float JoinElement(ASceneElement element, float distance, bool isPositive) { distance += GetNextInterval() * (isPositive ? 1 : -1); if (ScrollAxis == ScrollAxis.Horizontal) { element.SetPosition(new Vector3(LayerCamera.StartPosition.x + distance, 0, 0)); } else { element.SetPosition(new Vector3(0, LayerCamera.StartPosition.x + distance, 0)); } return(distance); }
protected override float JoinElement(ASceneElement element, float distance, bool isPositive) { float elementSpriteLen = GetElementSpriteLength(element); float sign = isPositive ? 1 : -1; Vector3 elementPos; if (ScrollAxis == ScrollAxis.Horizontal) { elementPos = new Vector3(LayerCamera.StartPosition.x + distance + sign * elementSpriteLen * 0.5f, 0, 0); } else { elementPos = new Vector3(0, LayerCamera.StartPosition.y + distance + sign * elementSpriteLen * 0.5f, 0); } element.SetPosition(elementPos); return(distance + sign * elementSpriteLen); }
public override void Modify(ASceneElement element) { Vector3 elementPos; if (scrollAxis == ScrollAxis.Horizontal) { elementPos = new Vector3(element.Position.x, sidePosition, element.Position.z); } else { elementPos = new Vector3(sidePosition, element.Position.y, element.Position.z); } element.SetPosition(elementPos); }