forked from cgvr/DeltaVR
quest marker slowly moves towards next target position
This commit is contained in:
Binary file not shown.
@@ -1,5 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
public class QuestMarker : MonoBehaviour
|
||||
@@ -8,6 +7,7 @@ public class QuestMarker : MonoBehaviour
|
||||
public float amplitude = 0.1f; // How far up/down it moves
|
||||
public float frequency = 1.5f; // Speed of oscillation
|
||||
public float heightAboveTarget = 0.75f;
|
||||
public float moveToTargetDuration = 2f;
|
||||
|
||||
private Vector3 startPos;
|
||||
private Transform playerTransform;
|
||||
@@ -57,13 +57,13 @@ public class QuestMarker : MonoBehaviour
|
||||
|
||||
public void MoveTo(Transform target, bool attach = false)
|
||||
{
|
||||
transform.position = target.position + new Vector3(0, heightAboveTarget, 0);
|
||||
hoverAboveTransform = null;
|
||||
transform.DOMove(target.position + new Vector3(0, heightAboveTarget, 0), moveToTargetDuration).OnComplete(() =>
|
||||
{
|
||||
if (attach)
|
||||
{
|
||||
hoverAboveTransform = target;
|
||||
} else
|
||||
{
|
||||
hoverAboveTransform = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user