Rough warehouse browsing by grabbing warehouse items with trigger

This commit is contained in:
2016-05-24 00:41:58 +02:00
parent 79a7a0b811
commit f44d87f51d
5 changed files with 70 additions and 8 deletions
+3 -3
View File
@@ -8,7 +8,7 @@ public class WarehouseColumn : MonoBehaviour {
private BezierCurve curve;
private Transform rows;
private float offset = 0.0f;
public float Offset { get; set; }
void Awake() {
curve = transform.Find("Curve").GetComponent<BezierCurve>();
@@ -21,12 +21,12 @@ public class WarehouseColumn : MonoBehaviour {
void Update() {
if (Application.isPlaying) {
offset += Time.deltaTime;
//offset += Time.deltaTime;
}
foreach (Transform row in rows) {
var i = row.GetSiblingIndex();
var distance = (float)i / (rows.childCount) * curve.length + offset;
var distance = (float)i / (rows.childCount) * curve.length + Offset;
distance = Mathf.Repeat(distance, curve.length);
var pos = curve.GetPointAtDistance(distance);
row.position = pos;