|
@@ -6,17 +6,34 @@ public class Trans_Float : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
public PlayerController controller;
|
|
public PlayerController controller;
|
|
|
|
|
|
|
|
- private bool isFirst = true; //第一次攻击
|
|
|
|
|
- private int times; //攻击次数
|
|
|
|
|
- public int minTime, maxTime; //保底范围
|
|
|
|
|
|
|
+ private bool isFirst = true; //第一次攻击
|
|
|
|
|
+ private int times; //攻击次数
|
|
|
|
|
+ public int minTime, maxTime; //保底范围
|
|
|
|
|
|
|
|
- public bool toFloat = false; //攻击触发漂浮
|
|
|
|
|
|
|
+ public bool toFloat = false; //攻击触发漂浮
|
|
|
|
|
+
|
|
|
|
|
+ private bool isK = false;
|
|
|
private Demonic dem;
|
|
private Demonic dem;
|
|
|
|
|
|
|
|
|
|
+ public GameObject lockeffect; //漂浮特效
|
|
|
|
|
+ private GameObject curlock; //当前漂浮特效
|
|
|
|
|
+ public GameObject fe;
|
|
|
|
|
+ private GameObject curFe;
|
|
|
|
|
+
|
|
|
|
|
+ private bool once = false;
|
|
|
|
|
+
|
|
|
|
|
+ public float keepFloatTime; //K键最大持续时间
|
|
|
|
|
+ private float pastTime;
|
|
|
|
|
+
|
|
|
private void Start()
|
|
private void Start()
|
|
|
{
|
|
{
|
|
|
controller = GetComponentInParent<PlayerController>();
|
|
controller = GetComponentInParent<PlayerController>();
|
|
|
dem = GetComponent<Demonic>();
|
|
dem = GetComponent<Demonic>();
|
|
|
|
|
+ controller.canMove = true;
|
|
|
|
|
+ curlock = Instantiate(lockeffect, new Vector3(0, -50, 0), new Quaternion(0, 0, 0, 0), null);
|
|
|
|
|
+ curFe = Instantiate(fe, curlock.transform.position, new Quaternion(0, 0, 0, 0), null);
|
|
|
|
|
+ curlock.SetActive(false);
|
|
|
|
|
+ curFe.SetActive(false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void Update()
|
|
private void Update()
|
|
@@ -48,8 +65,29 @@ public class Trans_Float : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
if (controller.isinputK)
|
|
if (controller.isinputK)
|
|
|
{
|
|
{
|
|
|
- controller.isinputK = false;
|
|
|
|
|
- print(2);
|
|
|
|
|
|
|
+ pastTime += Time.deltaTime;
|
|
|
|
|
+ controller.canMove = false;
|
|
|
|
|
+ if (!once)
|
|
|
|
|
+ {
|
|
|
|
|
+ isK = true;
|
|
|
|
|
+ once = true;
|
|
|
|
|
+ curlock.transform.position = transform.position;
|
|
|
|
|
+ curlock.SetActive(true);
|
|
|
|
|
+ }
|
|
|
|
|
+ curlock.transform.position += new Vector3(controller.moveVec.x, 0, 0);
|
|
|
|
|
+ if (pastTime >= keepFloatTime)
|
|
|
|
|
+ {
|
|
|
|
|
+ controller.isinputK = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(isK && !controller.isinputK)
|
|
|
|
|
+ {
|
|
|
|
|
+ isK = false;
|
|
|
|
|
+ controller.canMove = true;
|
|
|
|
|
+ once = false;
|
|
|
|
|
+ curFe.transform.position = curlock.transform.position;
|
|
|
|
|
+ curlock.SetActive(false);
|
|
|
|
|
+ curFe.SetActive(true);
|
|
|
}
|
|
}
|
|
|
if (controller.isinputL)
|
|
if (controller.isinputL)
|
|
|
{
|
|
{
|