|
|
@@ -31,6 +31,7 @@ public class ESpirits_Float : MonoBehaviour
|
|
|
private GameObject target;
|
|
|
private bool isDoing = false;
|
|
|
private bool isFollow = false;
|
|
|
+ private bool isOn = false;
|
|
|
private bool isLock = false;
|
|
|
private bool isAttack = false;
|
|
|
|
|
|
@@ -97,13 +98,19 @@ public class ESpirits_Float : MonoBehaviour
|
|
|
isFollow = true;
|
|
|
pastTime = 0;
|
|
|
curLock.SetActive(true);
|
|
|
+ curLock.transform.position = transform.position;
|
|
|
}
|
|
|
|
|
|
+ Vector3 sp = Vector3.zero;
|
|
|
+
|
|
|
private void FollowPlayer()
|
|
|
{
|
|
|
- if (target != null)
|
|
|
+ curLock.transform.position = Vector3.SmoothDamp(curLock.transform.position, target.transform.position, ref sp, 0.8f);
|
|
|
+ if (Vector3.Distance(curLock.transform.position, target.transform.position) <= 1f)
|
|
|
{
|
|
|
curLock.transform.position = target.transform.position;
|
|
|
+ isOn = true;
|
|
|
+ isFollow = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -144,13 +151,17 @@ public class ESpirits_Float : MonoBehaviour
|
|
|
//¸úËæÍæ¼Ò
|
|
|
if (isFollow)
|
|
|
{
|
|
|
- pastTime += Time.deltaTime;
|
|
|
FollowPlayer();
|
|
|
+ }
|
|
|
+ if (isOn)
|
|
|
+ {
|
|
|
+ pastTime += Time.deltaTime;
|
|
|
if (pastTime >= followTime)
|
|
|
{
|
|
|
isFollow = false;
|
|
|
isLock = true;
|
|
|
pastTime = 0;
|
|
|
+ isOn = false;
|
|
|
}
|
|
|
}
|
|
|
//Ëø¶¨·¶Î§
|