18 lines
456 B
C#
18 lines
456 B
C#
![]() |
using UnityEngine;
|
||
|
using DG.Tweening;
|
||
|
|
||
|
public class ButterflyMole : MonoBehaviour
|
||
|
{
|
||
|
public float jumpPower = 2f;
|
||
|
public float jumpDuration = 0.5f;
|
||
|
|
||
|
public void JumpTo(Vector3 target, ButterflyTarget butterfly)
|
||
|
{
|
||
|
Vector3 targetPos = new Vector3(target.x, target.y, transform.position.z);
|
||
|
transform.DOJump(targetPos, jumpPower, 1, jumpDuration).OnComplete(() =>
|
||
|
{
|
||
|
butterfly.OnCaught();
|
||
|
});
|
||
|
}
|
||
|
}
|