|
|
@@ -118,14 +118,14 @@ public class PlayerController : MoveCharacter
|
|
|
public float maxFlyHeight;
|
|
|
|
|
|
[Header("召唤属性")]
|
|
|
- public float totalCacheSummonTime = 0.1f;
|
|
|
+ public float cacheDir; //召唤的时候按左右召唤结束不会响应手感不好,缓存一下,召唤后摇期间有左右响应的话会转向
|
|
|
[HideInInspector]
|
|
|
public float summonTime;
|
|
|
[HideInInspector]
|
|
|
public float cacheSummonTime; //无法召唤时按下召唤键不会召唤,手感不好,缓存几帧,在这几帧内落地会立即召唤;
|
|
|
[HideInInspector]
|
|
|
public int cacheSummonId;
|
|
|
- public float cacheDir; //召唤的时候按左右召唤结束不会响应手感不好,缓存一下,召唤后摇期间有左右响应的话会转向
|
|
|
+
|
|
|
|
|
|
[Header("召唤使魔")]
|
|
|
public List<GameObject> demonicPrefabs;
|
|
|
@@ -152,6 +152,19 @@ public class PlayerController : MoveCharacter
|
|
|
[Header("锁魂塔")]
|
|
|
public GameObject curSoulTower;
|
|
|
|
|
|
+ //指挥功能
|
|
|
+ private float conductTime; //指挥按键长按时间
|
|
|
+ private int nowConductButton = -1; //现在按下的指挥键(0.J/1.K/2.L/-1.无)
|
|
|
+ [Header("召唤相应时间")] [Tooltip("在此时间内松手为召唤")] public float totalCacheSummonTime = 0.1f;
|
|
|
+ [Header("指挥相应时间")] [Tooltip("在此时间以外松手为指挥")] public float[] canConductTime;
|
|
|
+ [Header("指挥技能")] [Tooltip("选择相应的指挥技能")] public ConductSkills[] conductSkills;
|
|
|
+ public GameObject[] condectImportList; //用于指挥技能的预制体调用
|
|
|
+ public enum ConductSkills
|
|
|
+ {
|
|
|
+ Photosphere,
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public bool btnJumpPress
|
|
|
{
|
|
|
get
|
|
|
@@ -182,56 +195,96 @@ public class PlayerController : MoveCharacter
|
|
|
}
|
|
|
[HideInInspector]
|
|
|
public bool isKeepBtnRush;
|
|
|
- public bool btnSouthPress
|
|
|
+
|
|
|
+
|
|
|
+ public bool btnTransfiguratePress
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- //return Input.GetKeyDown(KeyCode.K) || isClickBtnSouth;
|
|
|
- return isClickBtnSouth;
|
|
|
+ //return Input.GetKeyDown(KeyCode.L) || isClickBtnEast;
|
|
|
+ return isClickBtnTransfigurate;
|
|
|
}
|
|
|
}
|
|
|
[HideInInspector]
|
|
|
- public bool isClickBtnSouth;
|
|
|
+ public bool isClickBtnTransfigurate;
|
|
|
public bool btnEastPress
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- //return Input.GetKeyDown(KeyCode.L) || isClickBtnEast;
|
|
|
return isClickBtnEast;
|
|
|
}
|
|
|
}
|
|
|
[HideInInspector]
|
|
|
public bool isClickBtnEast;
|
|
|
- public bool btnTransfiguratePress
|
|
|
+
|
|
|
+ public bool btnEastUp
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- //return Input.GetKeyDown(KeyCode.L) || isClickBtnEast;
|
|
|
- return isClickBtnTransfigurate;
|
|
|
+ return isBtnEastUp;
|
|
|
}
|
|
|
}
|
|
|
[HideInInspector]
|
|
|
- public bool isClickBtnTransfigurate;
|
|
|
+ public bool isBtnEastUp;
|
|
|
+
|
|
|
+ public bool btnSouthPress
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ //return Input.GetKeyDown(KeyCode.K) || isClickBtnSouth;
|
|
|
+ return isClickBtnSouth;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ [HideInInspector]
|
|
|
+ public bool isClickBtnSouth;
|
|
|
+
|
|
|
+
|
|
|
+ public bool btnSouthUp
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ //return Input.GetKeyDown(KeyCode.K) || isClickBtnSouth;
|
|
|
+ return isBtnSouthUp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ [HideInInspector]
|
|
|
+ public bool isBtnSouthUp;
|
|
|
public bool btnWestPress
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- //return Input.GetKeyDown(KeyCode.J) || isClickBtnWest;
|
|
|
return isClickBtnWest;
|
|
|
}
|
|
|
}
|
|
|
[HideInInspector]
|
|
|
public bool isClickBtnWest;
|
|
|
+ public bool btnWestUp
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return isBtnWestUp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ [HideInInspector]
|
|
|
+ public bool isBtnWestUp;
|
|
|
public bool btnNorthPress
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- //return Input.GetKeyDown(KeyCode.I) || isClickBtnNorth;
|
|
|
return isClickBtnNorth;
|
|
|
}
|
|
|
}
|
|
|
[HideInInspector]
|
|
|
public bool isClickBtnNorth;
|
|
|
+ public bool btnNorthUp
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return isBtnNorthUp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ [HideInInspector]
|
|
|
+ public bool isBtnNorthUp;
|
|
|
public bool btnSpiritSummon
|
|
|
{
|
|
|
get
|
|
|
@@ -429,48 +482,61 @@ public class PlayerController : MoveCharacter
|
|
|
}
|
|
|
void OnSummon0()
|
|
|
{
|
|
|
- if (!isFloat && canMove)
|
|
|
+ if (!isFloat && canMove && nowConductButton == -1)
|
|
|
{
|
|
|
isClickBtnWest = true;
|
|
|
+ nowConductButton = 0;
|
|
|
+ conductTime = 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void OnSummon0Up()
|
|
|
{
|
|
|
- switch (playerId)
|
|
|
+ if(nowConductButton == 0)
|
|
|
{
|
|
|
- case 0:
|
|
|
- if (SpiritSystem.isXbtnDown1)
|
|
|
- {
|
|
|
- SpiritSystem.isXbtnDown1 = false;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- if (SpiritSystem.isXbtnDown2)
|
|
|
- {
|
|
|
- SpiritSystem.isXbtnDown2 = false;
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
+ isBtnWestUp = true;
|
|
|
+ nowConductButton = -1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void OnSummon1()
|
|
|
{
|
|
|
- if (!isFloat && canMove)
|
|
|
+ if (!isFloat && canMove && nowConductButton == -1)
|
|
|
{
|
|
|
isClickBtnSouth = true;
|
|
|
+ nowConductButton = 1;
|
|
|
+ conductTime = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void OnSummon1Up()
|
|
|
+ {
|
|
|
+ if (nowConductButton == 1)
|
|
|
+ {
|
|
|
+ isBtnSouthUp = true;
|
|
|
+ nowConductButton = -1;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
void OnSummon2()
|
|
|
{
|
|
|
- if (!isFloat && canMove)
|
|
|
+ if (!isFloat && canMove && nowConductButton == -1)
|
|
|
{
|
|
|
isClickBtnEast = true;
|
|
|
+ nowConductButton = 2;
|
|
|
+ conductTime = 0;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ void OnSummon2Up()
|
|
|
+ {
|
|
|
+ if (nowConductButton == 2)
|
|
|
+ {
|
|
|
+ isBtnEastUp = true;
|
|
|
+ nowConductButton = -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//选英灵 (手柄右扳机,键盘TAB)
|
|
|
void OnChooseSpirit()
|
|
|
{
|
|
|
@@ -512,7 +578,6 @@ public class PlayerController : MoveCharacter
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public void Jump()
|
|
|
{
|
|
|
SetUpSpeed(jumpSpeed);
|
|
|
@@ -537,92 +602,39 @@ public class PlayerController : MoveCharacter
|
|
|
|
|
|
public bool CheckSummon()
|
|
|
{
|
|
|
- if (cacheSummonTime > 0)
|
|
|
- {
|
|
|
- Summon(cacheSummonId);
|
|
|
- return true;
|
|
|
- }
|
|
|
- if (btnWestPress)
|
|
|
+ if (isBtnEastUp || isBtnWestUp || isBtnSouthUp)
|
|
|
{
|
|
|
- if (!isBaseBtnOut)
|
|
|
- {
|
|
|
- CheckTurn();
|
|
|
- Summon(0);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- switch (playerId)
|
|
|
- {
|
|
|
- case 0:
|
|
|
- SpiritSystem.isXbtnDown1 = true;
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- SpiritSystem.isXbtnDown2 = true;
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
- if (btnSouthPress)
|
|
|
- {
|
|
|
- if (!isBaseBtnOut)
|
|
|
- {
|
|
|
- CheckTurn();
|
|
|
- Summon(1);
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
- if (btnEastPress)
|
|
|
- {
|
|
|
- if (!isBaseBtnOut)
|
|
|
+ if (cacheSummonTime >= 0 && conductTime <= totalCacheSummonTime)
|
|
|
{
|
|
|
+
|
|
|
CheckTurn();
|
|
|
- Summon(2);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- switch (playerId)
|
|
|
+ Summon(cacheSummonId);
|
|
|
+ switch (cacheSummonId)
|
|
|
{
|
|
|
case 0:
|
|
|
- SpiritSystem.isBbtnDown1 = true;
|
|
|
break;
|
|
|
case 1:
|
|
|
- SpiritSystem.isBbtnDown2 = true;
|
|
|
break;
|
|
|
- default:
|
|
|
+ case 2:
|
|
|
break;
|
|
|
}
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
- if (btnTransfiguratePress)
|
|
|
- {
|
|
|
- if (spirits.ultimateTimes[spirits.nowSpirit] > 0)
|
|
|
- {
|
|
|
- Summon((int)spirits.ownSpirits[spirits.nowSpirit] + 3);
|
|
|
+ Summon(cacheSummonId);
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
- if (isSpiritSummon)
|
|
|
- {
|
|
|
- Transfiguration(3);
|
|
|
- return true;
|
|
|
- }
|
|
|
- if (isSpiritSummon1)
|
|
|
+ if (nowConductButton != -1 && conductTime >= totalCacheSummonTime)
|
|
|
{
|
|
|
- Transfiguration(4);
|
|
|
+ CheckTurn();
|
|
|
+ ChangeState(CharacterState.Conduct);
|
|
|
return true;
|
|
|
}
|
|
|
- if (isSpiritSummon2)
|
|
|
- {
|
|
|
- Transfiguration(5);
|
|
|
- return true;
|
|
|
- }
|
|
|
- if (isSpiritSummon3)
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool CheckConduct()
|
|
|
+ {
|
|
|
+ if (isBtnEastUp || isBtnWestUp || isBtnSouthUp)
|
|
|
{
|
|
|
- Transfiguration(6);
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
@@ -633,7 +645,14 @@ public class PlayerController : MoveCharacter
|
|
|
{
|
|
|
if (!foot.TrigGround)
|
|
|
{
|
|
|
- if(excludeState != CharacterState.Summon)
|
|
|
+ //if(excludeState != CharacterState.Summon)
|
|
|
+ //{
|
|
|
+ // if (CheckSummon())
|
|
|
+ // {
|
|
|
+ // return true;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ if(excludeState != CharacterState.Summon || excludeState != CharacterState.Conduct)
|
|
|
{
|
|
|
if (CheckSummon())
|
|
|
{
|
|
|
@@ -684,14 +703,7 @@ public class PlayerController : MoveCharacter
|
|
|
}
|
|
|
//ChangeState(CharacterState.PullRope);
|
|
|
}
|
|
|
- if (excludeState != CharacterState.Summon)
|
|
|
- {
|
|
|
- if (CheckSummon())
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- if (excludeState != CharacterState.Transfiguration)
|
|
|
+ if (excludeState != CharacterState.Summon || excludeState != CharacterState.Conduct)
|
|
|
{
|
|
|
if (CheckSummon())
|
|
|
{
|
|
|
@@ -803,33 +815,31 @@ public class PlayerController : MoveCharacter
|
|
|
cacheSummonTime = totalCacheSummonTime;
|
|
|
cacheSummonId = 2;
|
|
|
}
|
|
|
- if (btnSpiritSummon)
|
|
|
- {
|
|
|
- cacheSummonTime = totalCacheSummonTime;
|
|
|
- cacheSummonId = 3;
|
|
|
- }
|
|
|
- if (btnSpiritSummon1)
|
|
|
- {
|
|
|
- cacheSummonTime = totalCacheSummonTime;
|
|
|
- cacheSummonId = 4;
|
|
|
- }
|
|
|
- if (btnSpiritSummon2)
|
|
|
- {
|
|
|
- cacheSummonTime = totalCacheSummonTime;
|
|
|
- cacheSummonId = 5;
|
|
|
- }
|
|
|
- if (btnSpiritSummon3)
|
|
|
- {
|
|
|
- cacheSummonTime = totalCacheSummonTime;
|
|
|
- cacheSummonId = 6;
|
|
|
- }
|
|
|
+ //if (btnSpiritSummon)
|
|
|
+ //{
|
|
|
+ // cacheSummonTime = totalCacheSummonTime;
|
|
|
+ // cacheSummonId = 3;
|
|
|
+ //}
|
|
|
+ //if (btnSpiritSummon1)
|
|
|
+ //{
|
|
|
+ // cacheSummonTime = totalCacheSummonTime;
|
|
|
+ // cacheSummonId = 4;
|
|
|
+ //}
|
|
|
+ //if (btnSpiritSummon2)
|
|
|
+ //{
|
|
|
+ // cacheSummonTime = totalCacheSummonTime;
|
|
|
+ // cacheSummonId = 5;
|
|
|
+ //}
|
|
|
+ //if (btnSpiritSummon3)
|
|
|
+ //{
|
|
|
+ // cacheSummonTime = totalCacheSummonTime;
|
|
|
+ // cacheSummonId = 6;
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
public override void OnState()
|
|
|
{
|
|
|
base.OnState();
|
|
|
-
|
|
|
- //hurtKeepTime -= Time.deltaTime;
|
|
|
cacheJumpTime -= Time.deltaTime;
|
|
|
cacheAttackTime -= Time.deltaTime;
|
|
|
cacheSummonTime -= Time.deltaTime;
|
|
|
@@ -842,6 +852,11 @@ public class PlayerController : MoveCharacter
|
|
|
dieKeepTime -= Time.deltaTime;
|
|
|
weakTime -= Time.deltaTime;
|
|
|
beRepelValue += Time.deltaTime;
|
|
|
+ if(nowConductButton != -1)
|
|
|
+ {
|
|
|
+ conductTime += Time.deltaTime;
|
|
|
+ }
|
|
|
+ CachedPlayerInput();
|
|
|
Vector3 velocity = rb.velocity;
|
|
|
switch (state)
|
|
|
{
|
|
|
@@ -851,6 +866,7 @@ public class PlayerController : MoveCharacter
|
|
|
break;
|
|
|
}
|
|
|
rb.velocity = Vector3.right * velocityAddition;
|
|
|
+
|
|
|
break;
|
|
|
case CharacterState.Run:
|
|
|
if (CheckPlayerChangeState(CharacterState.Run))
|
|
|
@@ -894,7 +910,6 @@ public class PlayerController : MoveCharacter
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- CachedPlayerInput();
|
|
|
rb.velocity = AirMove(rb.velocity);
|
|
|
if (rb.velocity.y <= 0)
|
|
|
{
|
|
|
@@ -948,7 +963,6 @@ public class PlayerController : MoveCharacter
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- CachedPlayerInput();
|
|
|
rb.velocity = AirMove(rb.velocity);
|
|
|
break;
|
|
|
//case CharacterState.Hurt:
|
|
|
@@ -991,7 +1005,6 @@ public class PlayerController : MoveCharacter
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- CachedPlayerInput();
|
|
|
break;
|
|
|
case CharacterState.KeepAttack:
|
|
|
if ((btnRushPress) && mp >= rushCostMp)
|
|
|
@@ -1174,7 +1187,7 @@ public class PlayerController : MoveCharacter
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- CachedPlayerInput();
|
|
|
+
|
|
|
//if (leftDir.magnitude < 0.3f)
|
|
|
//{
|
|
|
// if (bodyTrans.localScale.x > 0)
|
|
|
@@ -1209,7 +1222,6 @@ public class PlayerController : MoveCharacter
|
|
|
}
|
|
|
mp -= sprintCostMp * Time.deltaTime;
|
|
|
uiMp.Show(mp, totalMp);
|
|
|
- CachedPlayerInput();
|
|
|
//CheckTurn();
|
|
|
//if (leftDir.magnitude < 0.3f)
|
|
|
//{
|
|
|
@@ -1292,6 +1304,12 @@ public class PlayerController : MoveCharacter
|
|
|
break;
|
|
|
case CharacterState.PullRope:
|
|
|
|
|
|
+ break;
|
|
|
+ case CharacterState.Conduct:
|
|
|
+ if (CheckConduct())
|
|
|
+ {
|
|
|
+ ChangeState(CharacterState.Idle);
|
|
|
+ }
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
@@ -1314,6 +1332,10 @@ public class PlayerController : MoveCharacter
|
|
|
isClickBtnEast = false;
|
|
|
isClickBtnNorth = false;
|
|
|
isClickBtnWest = false;
|
|
|
+ isBtnSouthUp = false;
|
|
|
+ isBtnEastUp = false;
|
|
|
+ isBtnNorthUp = false;
|
|
|
+ isBtnWestUp = false;
|
|
|
isSpiritSummon = false;
|
|
|
isSpiritSummon1 = false;
|
|
|
isSpiritSummon2 = false;
|
|
|
@@ -1613,6 +1635,9 @@ public class PlayerController : MoveCharacter
|
|
|
weakTime = totalWeakTime;
|
|
|
//hurtKeepTime = minHurtKeepTime;
|
|
|
break;
|
|
|
+ case CharacterState.Conduct:
|
|
|
+ rb.velocity = Vector3.zero;
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|