public void Execute([ReadOnly] ref Translation translation, [ReadOnly] ref ProjectileComponentData projectile, ref CastSpritesShadowComponentData shadow, [ReadOnly] ref CastProjectileShadowsTagComponentData tag) { var startPos = projectile.startPosition; var endPos = projectile.targetPosition; var lerpAmount = endPos - startPos; var localPos = translation.Value.ToF2() - startPos; var t = 0f; if (lerpAmount.x != 0) { t = localPos.x / lerpAmount.x; } t = math.clamp(math.abs(t), 0, 1); //позиция относительно которой надо считать сдвиг //и лежит она на прямой (startPos, endPos) var lerpedPos = math.lerp(startPos, endPos, t); //теперь надо посчитать сaм сдвиг var offset = new float2(0, -math.abs(translation.Value.y - lerpedPos.y) * 2); var startOffset = math.lerp(tag.startPositionOffset, 0, t); var endOffset = math.lerp(tag.endPositionOffset, 0, t); offset += startOffset + endOffset; var olphaLerpAmount = 1f; if (tag.maxYOffsetForLerpScaleAndAlpha != 0) { olphaLerpAmount = math.clamp(math.abs(offset.y / tag.maxYOffsetForLerpScaleAndAlpha), 0, 1); } var alpha = math.lerp(tag.defaultAlpha, tag.defaultAlpha * tag.alphaMultiplier, olphaLerpAmount); var scale = math.lerp(tag.defaultScale, tag.defaultScale * tag.scaleMultiplier, olphaLerpAmount); shadow.positionUnitsOffset = offset.ToF3(0); shadow.color.a = alpha; shadow.scale = scale; }