|
@@ -12,7 +12,20 @@ public class Trans_Float : MonoBehaviour
|
|
|
public int mpK;
|
|
public int mpK;
|
|
|
public int mpL;
|
|
public int mpL;
|
|
|
|
|
|
|
|
- public float intervalTime; //攻击硬直
|
|
|
|
|
|
|
+ public float CDJ;
|
|
|
|
|
+ public float CDK;
|
|
|
|
|
+ public float CDL;
|
|
|
|
|
+ private float pastCDJ;
|
|
|
|
|
+ private float pastCDK;
|
|
|
|
|
+ private float pastCDL;
|
|
|
|
|
+ private bool isCDJ;
|
|
|
|
|
+ private bool isCDK;
|
|
|
|
|
+ private bool isCDL;
|
|
|
|
|
+
|
|
|
|
|
+ public float intervalTimeJ; //攻击硬直
|
|
|
|
|
+ public float intervalTimeK; //攻击硬直
|
|
|
|
|
+ public float intervalTimeL; //攻击硬直
|
|
|
|
|
+ private float intervalTime;
|
|
|
private float pastAttackTime;
|
|
private float pastAttackTime;
|
|
|
private bool canAttack = true;
|
|
private bool canAttack = true;
|
|
|
|
|
|
|
@@ -34,13 +47,21 @@ public class Trans_Float : MonoBehaviour
|
|
|
private bool once = false;
|
|
private bool once = false;
|
|
|
|
|
|
|
|
public float keepFloatTime; //K键最大持续时间
|
|
public float keepFloatTime; //K键最大持续时间
|
|
|
|
|
+ public float minRange, maxRange; //K键浮空场范围
|
|
|
|
|
+ public int maxKMp; //K键最大耗蓝
|
|
|
private float pastTime;
|
|
private float pastTime;
|
|
|
|
|
+ private float continueMp; //mp持续减少程度
|
|
|
|
|
+ private float isLosingMp;
|
|
|
|
|
+ private float continueRange; //浮空场持续变宽程度
|
|
|
|
|
|
|
|
- public int LAttackDamage; //L键摔落伤害
|
|
|
|
|
|
|
+ public int LAttackDamage; //L键摔落伤害
|
|
|
|
|
|
|
|
private void Start()
|
|
private void Start()
|
|
|
{
|
|
{
|
|
|
controller = GetComponentInParent<PlayerController>();
|
|
controller = GetComponentInParent<PlayerController>();
|
|
|
|
|
+ controller.isMpRepel = false;
|
|
|
|
|
+ controller.mp = controller.totalMp;
|
|
|
|
|
+ controller.uiMp.Show(controller.mp, controller.totalMp);
|
|
|
//controller.changeTime = changeTime;
|
|
//controller.changeTime = changeTime;
|
|
|
dem = GetComponent<Demonic>();
|
|
dem = GetComponent<Demonic>();
|
|
|
controller.canMove = true;
|
|
controller.canMove = true;
|
|
@@ -50,8 +71,41 @@ public class Trans_Float : MonoBehaviour
|
|
|
curFe.SetActive(false);
|
|
curFe.SetActive(false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void OnDisable()
|
|
|
|
|
+ {
|
|
|
|
|
+ controller.isMpRepel = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void DeMp(int deMP)
|
|
|
|
|
+ {
|
|
|
|
|
+ controller.mp -= deMP;
|
|
|
|
|
+ controller.uiMp.Show(controller.mp, controller.totalMp);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void ToInterval(int deMP)
|
|
|
|
|
+ {
|
|
|
|
|
+ DeMp(deMP);
|
|
|
|
|
+ if (intervalTime != 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ controller.canMove = false;
|
|
|
|
|
+ canAttack = false;
|
|
|
|
|
+ controller.ChangeState(CharacterState.Idle);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ controller.canMove = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void KContinueValue()
|
|
|
|
|
+ {
|
|
|
|
|
+ continueMp = (maxKMp - mpK) / keepFloatTime;
|
|
|
|
|
+ continueRange = (maxRange - minRange) / keepFloatTime;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void Update()
|
|
private void Update()
|
|
|
{
|
|
{
|
|
|
|
|
+ //硬直
|
|
|
if (!canAttack)
|
|
if (!canAttack)
|
|
|
{
|
|
{
|
|
|
pastAttackTime += Time.deltaTime;
|
|
pastAttackTime += Time.deltaTime;
|
|
@@ -59,16 +113,46 @@ public class Trans_Float : MonoBehaviour
|
|
|
{
|
|
{
|
|
|
canAttack = true;
|
|
canAttack = true;
|
|
|
pastAttackTime = 0;
|
|
pastAttackTime = 0;
|
|
|
|
|
+ controller.canMove = true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (controller.isinputJ && canAttack)
|
|
|
|
|
|
|
+ if (isCDJ)
|
|
|
|
|
+ {
|
|
|
|
|
+ pastCDJ += Time.deltaTime;
|
|
|
|
|
+ if (pastCDJ >= CDJ)
|
|
|
|
|
+ {
|
|
|
|
|
+ isCDJ = false;
|
|
|
|
|
+ pastCDJ = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isCDK)
|
|
|
|
|
+ {
|
|
|
|
|
+ pastCDK += Time.deltaTime;
|
|
|
|
|
+ if (pastCDK >= CDK)
|
|
|
|
|
+ {
|
|
|
|
|
+ isCDK = false;
|
|
|
|
|
+ pastCDK = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isCDL)
|
|
|
|
|
+ {
|
|
|
|
|
+ pastCDL += Time.deltaTime;
|
|
|
|
|
+ if (pastCDL >= CDL)
|
|
|
|
|
+ {
|
|
|
|
|
+ isCDL = false;
|
|
|
|
|
+ pastCDL = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //J
|
|
|
|
|
+ if (!isCDJ && controller.isinputJ && canAttack)
|
|
|
{
|
|
{
|
|
|
if (controller.mp >= mpJ)
|
|
if (controller.mp >= mpJ)
|
|
|
{
|
|
{
|
|
|
- controller.mp -= mpJ;
|
|
|
|
|
- controller.uiMp.Show(controller.mp, controller.totalMp);
|
|
|
|
|
- canAttack = false;
|
|
|
|
|
|
|
+ isCDJ = true;
|
|
|
|
|
+ intervalTime = intervalTimeJ;
|
|
|
|
|
+ ToInterval(mpJ);
|
|
|
controller.isinputJ = false;
|
|
controller.isinputJ = false;
|
|
|
|
|
+ //首次攻击触发漂浮
|
|
|
if (isFirst)
|
|
if (isFirst)
|
|
|
{
|
|
{
|
|
|
if (!dem.attackToFloat)
|
|
if (!dem.attackToFloat)
|
|
@@ -77,6 +161,7 @@ public class Trans_Float : MonoBehaviour
|
|
|
dem.attackToFloat = true;
|
|
dem.attackToFloat = true;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ //攻击保底min~max次触发漂浮
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
if (!dem.attackToFloat)
|
|
if (!dem.attackToFloat)
|
|
@@ -96,25 +181,37 @@ public class Trans_Float : MonoBehaviour
|
|
|
Debug.Log("mp不足");
|
|
Debug.Log("mp不足");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (controller.isinputK)
|
|
|
|
|
|
|
+ //K
|
|
|
|
|
+ if (!isCDK && controller.isinputK)
|
|
|
{
|
|
{
|
|
|
if (controller.mp >= mpK)
|
|
if (controller.mp >= mpK)
|
|
|
{
|
|
{
|
|
|
- pastTime += Time.deltaTime;
|
|
|
|
|
- controller.canMove = false;
|
|
|
|
|
- controller.ChangeState(CharacterState.Idle);
|
|
|
|
|
- //controller.rb.velocity = new Vector3(0, 0, 0);
|
|
|
|
|
if (!once)
|
|
if (!once)
|
|
|
{
|
|
{
|
|
|
|
|
+ controller.canMove = false;
|
|
|
|
|
+ controller.ChangeState(CharacterState.Idle);
|
|
|
|
|
+ KContinueValue();
|
|
|
|
|
+ once = true;
|
|
|
isK = true;
|
|
isK = true;
|
|
|
once = true;
|
|
once = true;
|
|
|
curlock.transform.position = transform.position;
|
|
curlock.transform.position = transform.position;
|
|
|
|
|
+ Vector3 orig = curlock.transform.localScale;
|
|
|
|
|
+ curlock.transform.localScale = new Vector3(minRange, orig.y, orig.z);
|
|
|
curlock.SetActive(true);
|
|
curlock.SetActive(true);
|
|
|
}
|
|
}
|
|
|
- curlock.transform.position += new Vector3(controller.moveVec.x, 0, 0) * moveSpeed;
|
|
|
|
|
- if (pastTime >= keepFloatTime)
|
|
|
|
|
|
|
+ if (pastTime <= keepFloatTime)
|
|
|
{
|
|
{
|
|
|
- controller.isinputK = false;
|
|
|
|
|
|
|
+ pastTime += Time.deltaTime;
|
|
|
|
|
+ isLosingMp += continueMp * Time.deltaTime;
|
|
|
|
|
+ if (isLosingMp >= mpK)
|
|
|
|
|
+ {
|
|
|
|
|
+ DeMp(mpK);
|
|
|
|
|
+ isLosingMp -= mpK;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (curlock.transform.localScale.x < maxRange)
|
|
|
|
|
+ {
|
|
|
|
|
+ curlock.transform.localScale += new Vector3(continueRange * Time.deltaTime, 0, 0);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
@@ -124,23 +221,26 @@ public class Trans_Float : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
if(isK && !controller.isinputK)
|
|
if(isK && !controller.isinputK)
|
|
|
{
|
|
{
|
|
|
- controller.mp -= mpK;
|
|
|
|
|
- controller.uiMp.Show(controller.mp, controller.totalMp);
|
|
|
|
|
|
|
+ isCDK = true;
|
|
|
pastTime = 0;
|
|
pastTime = 0;
|
|
|
isK = false;
|
|
isK = false;
|
|
|
- controller.canMove = true;
|
|
|
|
|
- controller.ChangeState(CharacterState.Idle);
|
|
|
|
|
|
|
+ intervalTime = intervalTimeK;
|
|
|
|
|
+ ToInterval(0);
|
|
|
once = false;
|
|
once = false;
|
|
|
curFe.transform.position = curlock.transform.position;
|
|
curFe.transform.position = curlock.transform.position;
|
|
|
|
|
+ Vector3 v = curFe.transform.localScale;
|
|
|
|
|
+ curFe.transform.localScale = new Vector3(curlock.transform.localScale.x, v.y, v.z);
|
|
|
curlock.SetActive(false);
|
|
curlock.SetActive(false);
|
|
|
curFe.SetActive(true);
|
|
curFe.SetActive(true);
|
|
|
}
|
|
}
|
|
|
- if (controller.isinputL)
|
|
|
|
|
|
|
+ //L
|
|
|
|
|
+ if (!isCDL && controller.isinputL)
|
|
|
{
|
|
{
|
|
|
if (controller.mp >= mpL)
|
|
if (controller.mp >= mpL)
|
|
|
{
|
|
{
|
|
|
- controller.mp -= mpL;
|
|
|
|
|
- controller.uiMp.Show(controller.mp, controller.totalMp);
|
|
|
|
|
|
|
+ isCDL = true;
|
|
|
|
|
+ intervalTime = intervalTimeL;
|
|
|
|
|
+ ToInterval(mpL);
|
|
|
controller.isinputL = false;
|
|
controller.isinputL = false;
|
|
|
foreach (MoveCharacter f in FloatData.eneIsFloating)
|
|
foreach (MoveCharacter f in FloatData.eneIsFloating)
|
|
|
{
|
|
{
|