|
|
@@ -8,6 +8,10 @@ public class Trans_Float : MonoBehaviour
|
|
|
public float changeTime;
|
|
|
public Vector3 UIoffset; //UI调整值
|
|
|
|
|
|
+ public int mpJ;
|
|
|
+ public int mpK;
|
|
|
+ public int mpL;
|
|
|
+
|
|
|
public float intervalTime; //攻击硬直
|
|
|
private float pastAttackTime;
|
|
|
private bool canAttack = true;
|
|
|
@@ -32,6 +36,8 @@ public class Trans_Float : MonoBehaviour
|
|
|
public float keepFloatTime; //K键最大持续时间
|
|
|
private float pastTime;
|
|
|
|
|
|
+ public float LAttackDamage; //L键摔落伤害
|
|
|
+
|
|
|
private void Start()
|
|
|
{
|
|
|
controller = GetComponentInParent<PlayerController>();
|
|
|
@@ -57,51 +63,69 @@ public class Trans_Float : MonoBehaviour
|
|
|
}
|
|
|
if (controller.isinputJ && canAttack)
|
|
|
{
|
|
|
- canAttack = false;
|
|
|
- controller.isinputJ = false;
|
|
|
- if (isFirst)
|
|
|
+ if (controller.mp >= mpJ)
|
|
|
{
|
|
|
- if (!dem.attackToFloat)
|
|
|
+ controller.mp -= mpJ;
|
|
|
+ controller.uiMp.Show(controller.mp, controller.totalMp);
|
|
|
+ canAttack = false;
|
|
|
+ controller.isinputJ = false;
|
|
|
+ if (isFirst)
|
|
|
{
|
|
|
- isFirst = false;
|
|
|
- dem.attackToFloat = true;
|
|
|
+ if (!dem.attackToFloat)
|
|
|
+ {
|
|
|
+ isFirst = false;
|
|
|
+ dem.attackToFloat = true;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (!dem.attackToFloat)
|
|
|
+ else
|
|
|
{
|
|
|
- times += 1;
|
|
|
- if (times >= minTime || times == maxTime)
|
|
|
+ if (!dem.attackToFloat)
|
|
|
{
|
|
|
- times = 0;
|
|
|
- dem.attackToFloat = true;
|
|
|
+ times += 1;
|
|
|
+ if (times >= minTime || times == maxTime)
|
|
|
+ {
|
|
|
+ times = 0;
|
|
|
+ dem.attackToFloat = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ dem.Attack2();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Debug.Log("mp不足");
|
|
|
}
|
|
|
- dem.Attack2();
|
|
|
}
|
|
|
if (controller.isinputK)
|
|
|
{
|
|
|
- pastTime += Time.deltaTime;
|
|
|
- controller.canMove = false;
|
|
|
- controller.ChangeState(CharacterState.Idle);
|
|
|
- //controller.rb.velocity = new Vector3(0, 0, 0);
|
|
|
- if (!once)
|
|
|
+ if (controller.mp >= mpK)
|
|
|
{
|
|
|
- isK = true;
|
|
|
- once = true;
|
|
|
- curlock.transform.position = transform.position;
|
|
|
- curlock.SetActive(true);
|
|
|
+ pastTime += Time.deltaTime;
|
|
|
+ controller.canMove = false;
|
|
|
+ controller.ChangeState(CharacterState.Idle);
|
|
|
+ //controller.rb.velocity = new Vector3(0, 0, 0);
|
|
|
+ if (!once)
|
|
|
+ {
|
|
|
+ isK = true;
|
|
|
+ once = true;
|
|
|
+ curlock.transform.position = transform.position;
|
|
|
+ curlock.SetActive(true);
|
|
|
+ }
|
|
|
+ curlock.transform.position += new Vector3(controller.moveVec.x, 0, 0) * moveSpeed;
|
|
|
+ if (pastTime >= keepFloatTime)
|
|
|
+ {
|
|
|
+ controller.isinputK = false;
|
|
|
+ }
|
|
|
}
|
|
|
- curlock.transform.position += new Vector3(controller.moveVec.x, 0, 0) * moveSpeed;
|
|
|
- if (pastTime >= keepFloatTime)
|
|
|
+ else
|
|
|
{
|
|
|
- controller.isinputK = false;
|
|
|
+ Debug.Log("mp不足");
|
|
|
}
|
|
|
}
|
|
|
if(isK && !controller.isinputK)
|
|
|
{
|
|
|
+ controller.mp -= mpK;
|
|
|
+ controller.uiMp.Show(controller.mp, controller.totalMp);
|
|
|
pastTime = 0;
|
|
|
isK = false;
|
|
|
controller.canMove = true;
|
|
|
@@ -113,15 +137,24 @@ public class Trans_Float : MonoBehaviour
|
|
|
}
|
|
|
if (controller.isinputL)
|
|
|
{
|
|
|
- controller.isinputL = false;
|
|
|
- foreach(MoveCharacter f in FloatData.eneIsFloating)
|
|
|
+ if (controller.mp >= mpL)
|
|
|
{
|
|
|
- if (f.isFloat)
|
|
|
+ controller.mp -= mpL;
|
|
|
+ controller.uiMp.Show(controller.mp, controller.totalMp);
|
|
|
+ controller.isinputL = false;
|
|
|
+ foreach (MoveCharacter f in FloatData.eneIsFloating)
|
|
|
{
|
|
|
- f.FloatDrop();
|
|
|
- FloatData.Clear(1);
|
|
|
+ if (f.isFloat)
|
|
|
+ {
|
|
|
+ f.FloatDrop();
|
|
|
+ FloatData.Clear(1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Debug.Log("mp不足");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|