|
|
@@ -125,7 +125,7 @@ public class PlayerController : MoveCharacter
|
|
|
public float cacheSummonTime; //无法召唤时按下召唤键不会召唤,手感不好,缓存几帧,在这几帧内落地会立即召唤;
|
|
|
[HideInInspector]
|
|
|
public int cacheSummonId;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
[Header("召唤使魔")]
|
|
|
public List<GameObject> demonicPrefabs;
|
|
|
@@ -187,6 +187,8 @@ public class PlayerController : MoveCharacter
|
|
|
public GameObject wavePowerObj;
|
|
|
//御剑术
|
|
|
public GameObject flyingSwordsObj;
|
|
|
+ //怨气弹
|
|
|
+ public GameObject angryBulletObj;
|
|
|
|
|
|
public enum ConductSkills
|
|
|
{
|
|
|
@@ -198,6 +200,7 @@ public class PlayerController : MoveCharacter
|
|
|
WavePower, //气功师:气功波
|
|
|
SwordsControl, //气功师:御剑术
|
|
|
|
|
|
+ AngryBullet, //弓箭手:怨气弹
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -426,7 +429,7 @@ public class PlayerController : MoveCharacter
|
|
|
}
|
|
|
skeletonMecanim.skeletonDataAsset = playerSpine[playerId];
|
|
|
demonicDic = new Dictionary<int, List<Demonic>>();
|
|
|
- for(int i = 0; i < 3; i++)
|
|
|
+ for (int i = 0; i < 3; i++)
|
|
|
{
|
|
|
demonicDic.Add(i, new List<Demonic>());
|
|
|
}
|
|
|
@@ -478,11 +481,11 @@ public class PlayerController : MoveCharacter
|
|
|
portalsController.rbs.Remove(rb);
|
|
|
}
|
|
|
}
|
|
|
- if(rightDir.x<-0.5 || rightDir.x > 0.5)
|
|
|
+ if (rightDir.x < -0.5 || rightDir.x > 0.5)
|
|
|
{
|
|
|
ChangeSpirit();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -532,7 +535,7 @@ public class PlayerController : MoveCharacter
|
|
|
|
|
|
void OnSummon0Up()
|
|
|
{
|
|
|
- if(nowConductButton == 0)
|
|
|
+ if (nowConductButton == 0)
|
|
|
{
|
|
|
isBtnWestUp = true;
|
|
|
cacheConductId = nowConductButton;
|
|
|
@@ -604,7 +607,7 @@ public class PlayerController : MoveCharacter
|
|
|
}
|
|
|
|
|
|
//召唤英灵
|
|
|
- void OnTransfigurate()
|
|
|
+ void OnTransfigurate()
|
|
|
{
|
|
|
if (!keyTransfigurateRelease && !isFloat && canMove && !isBaseBtnOut)
|
|
|
{
|
|
|
@@ -647,7 +650,7 @@ public class PlayerController : MoveCharacter
|
|
|
{
|
|
|
if (btnTransfiguratePress)
|
|
|
{
|
|
|
- if(spirits.ultimateTimes[spirits.nowSpirit] > 0)
|
|
|
+ if (spirits.ultimateTimes[spirits.nowSpirit] > 0)
|
|
|
{
|
|
|
Summon((int)spirits.ownSpirits[spirits.nowSpirit] + 3);
|
|
|
return true;
|
|
|
@@ -663,7 +666,7 @@ public class PlayerController : MoveCharacter
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
- if (state!=CharacterState.Conduct && nowConductButton != -1 && conductTime >= 0)
|
|
|
+ if (state != CharacterState.Conduct && nowConductButton != -1 && conductTime >= 0)
|
|
|
{
|
|
|
CheckTurn();
|
|
|
if (conductCanRelease[nowConductButton])
|
|
|
@@ -671,7 +674,7 @@ public class PlayerController : MoveCharacter
|
|
|
ChangeState(CharacterState.Conduct);
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
@@ -726,7 +729,7 @@ public class PlayerController : MoveCharacter
|
|
|
{
|
|
|
int dienum = demonicDic[1].Count;
|
|
|
int tempthp = giantNum * 1000;
|
|
|
- foreach(Demonic d in giants)
|
|
|
+ foreach (Demonic d in giants)
|
|
|
{
|
|
|
d.ChangeState(CharacterState.Die);
|
|
|
}
|
|
|
@@ -772,7 +775,7 @@ public class PlayerController : MoveCharacter
|
|
|
}
|
|
|
break;
|
|
|
case ConductSkills.Photosphere:
|
|
|
- if(demonicDic[1].Count > 0)
|
|
|
+ if (demonicDic[1].Count > 0)
|
|
|
{
|
|
|
conductCanRelease[cacheConductId] = false;
|
|
|
GameObject obj = GameObject.Instantiate(photosphereObj, transform);
|
|
|
@@ -791,7 +794,7 @@ public class PlayerController : MoveCharacter
|
|
|
if (demonicDic[1].Count > 0)
|
|
|
{
|
|
|
List<Demonic> newGiants = new List<Demonic>();
|
|
|
- foreach(Demonic d in giants)
|
|
|
+ foreach (Demonic d in giants)
|
|
|
{
|
|
|
if (!d.isDie)
|
|
|
{
|
|
|
@@ -804,10 +807,10 @@ public class PlayerController : MoveCharacter
|
|
|
}
|
|
|
}
|
|
|
giants = newGiants;
|
|
|
- foreach(Demonic d in giants)
|
|
|
+ foreach (Demonic d in giants)
|
|
|
{
|
|
|
int[] damages = d.curDamage;
|
|
|
- for(int i = 0; i < damages.Length; i++)
|
|
|
+ for (int i = 0; i < damages.Length; i++)
|
|
|
{
|
|
|
damages[i] += giantNum * swordNum;
|
|
|
}
|
|
|
@@ -825,7 +828,7 @@ public class PlayerController : MoveCharacter
|
|
|
conductCanRelease[cacheConductId] = false;
|
|
|
if (curMountain == null)
|
|
|
{
|
|
|
- curMountain= GameObject.Instantiate(mountain, transform);
|
|
|
+ curMountain = GameObject.Instantiate(mountain, transform);
|
|
|
curMountain.transform.position = transform.position + offset;
|
|
|
curMountain.GetComponent<Mountain>().pc = this;
|
|
|
curMountain.GetComponent<Mountain>().id = cacheConductId;
|
|
|
@@ -870,6 +873,23 @@ public class PlayerController : MoveCharacter
|
|
|
costMp = false;
|
|
|
}
|
|
|
break;
|
|
|
+ //弓箭手
|
|
|
+ case ConductSkills.AngryBullet:
|
|
|
+ if (demonicDic[0].Count > 0)
|
|
|
+ {
|
|
|
+ conductCanRelease[cacheConductId] = false;
|
|
|
+ GameObject obj = Instantiate(angryBulletObj);
|
|
|
+ AngryBulletControl angryBulletControl = obj.GetComponent<AngryBulletControl>();
|
|
|
+ angryBulletControl.playerController = this;
|
|
|
+ angryBulletControl.cacheConductId = cacheConductId;
|
|
|
+ angryBulletControl.maxNum = demonicDic[0].Count * 7;
|
|
|
+ //InvokeRepeating("ShootAngryBullet", demonicDic[0].Count * 7, 0.2f);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ costMp = false;
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
if (costMp)
|
|
|
{
|
|
|
@@ -886,6 +906,9 @@ public class PlayerController : MoveCharacter
|
|
|
print("蓝量不足");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//角色处于可自由活动状态时的通用切换状态逻辑,如Idle、Run状态,以及别的状态结束时准备回到Idle状态前
|
|
|
public bool CheckPlayerChangeState(CharacterState excludeState = CharacterState.None)
|
|
|
{
|
|
|
@@ -898,7 +921,7 @@ public class PlayerController : MoveCharacter
|
|
|
// return true;
|
|
|
// }
|
|
|
//}
|
|
|
- if(excludeState != CharacterState.Summon || excludeState != CharacterState.Conduct)
|
|
|
+ if (excludeState != CharacterState.Summon || excludeState != CharacterState.Conduct)
|
|
|
{
|
|
|
if (CheckSummon())
|
|
|
{
|
|
|
@@ -973,7 +996,7 @@ public class PlayerController : MoveCharacter
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
- if(leftDir.y< -0.5)
|
|
|
+ if (leftDir.y < -0.5)
|
|
|
{
|
|
|
Platform platform = foot.trigGroundList[0].GetComponent<Platform>();
|
|
|
if (platform != null && platform.canDown)
|
|
|
@@ -1098,7 +1121,7 @@ public class PlayerController : MoveCharacter
|
|
|
dieKeepTime -= Time.deltaTime;
|
|
|
weakTime -= Time.deltaTime;
|
|
|
beRepelValue += Time.deltaTime;
|
|
|
- if(nowConductButton != -1)
|
|
|
+ if (nowConductButton != -1)
|
|
|
{
|
|
|
conductTime += Time.deltaTime;
|
|
|
}
|
|
|
@@ -1112,7 +1135,7 @@ public class PlayerController : MoveCharacter
|
|
|
break;
|
|
|
}
|
|
|
rb.velocity = Vector3.right * velocityAddition;
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
case CharacterState.Run:
|
|
|
if (CheckPlayerChangeState(CharacterState.Run))
|
|
|
@@ -1128,11 +1151,11 @@ public class PlayerController : MoveCharacter
|
|
|
{
|
|
|
if (leftDir.x > 0.3f)
|
|
|
{
|
|
|
- rb.velocity = new Vector3(moveSpeed+velocityAddition,0,0);
|
|
|
+ rb.velocity = new Vector3(moveSpeed + velocityAddition, 0, 0);
|
|
|
}
|
|
|
else if (leftDir.x < -0.3f)
|
|
|
{
|
|
|
- rb.velocity = new Vector3(-moveSpeed + velocityAddition,0,0);
|
|
|
+ rb.velocity = new Vector3(-moveSpeed + velocityAddition, 0, 0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1230,7 +1253,7 @@ public class PlayerController : MoveCharacter
|
|
|
// {
|
|
|
// vel += Vector3.up * extraFallGravity * Time.deltaTime;
|
|
|
// }
|
|
|
-
|
|
|
+
|
|
|
// }
|
|
|
// vel.x = vel.x * (1 - decelerationRatio * Time.deltaTime);
|
|
|
// rb.velocity = vel;
|
|
|
@@ -1493,7 +1516,7 @@ public class PlayerController : MoveCharacter
|
|
|
if (isRevive)
|
|
|
{
|
|
|
reviveTime += Time.deltaTime;
|
|
|
- if(reviveTime >= totalReviveTime)
|
|
|
+ if (reviveTime >= totalReviveTime)
|
|
|
{
|
|
|
PlayerRevive();
|
|
|
}
|
|
|
@@ -1712,7 +1735,7 @@ public class PlayerController : MoveCharacter
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- if(newState == CharacterState.Weak)
|
|
|
+ if (newState == CharacterState.Weak)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
@@ -1742,7 +1765,7 @@ public class PlayerController : MoveCharacter
|
|
|
break;
|
|
|
case CharacterState.Summon:
|
|
|
rb.isKinematic = false;
|
|
|
- if(cacheDir != 0)
|
|
|
+ if (cacheDir != 0)
|
|
|
{
|
|
|
if (cacheDir > 0.3f && bodyTrans.localScale.x > 0)
|
|
|
{
|
|
|
@@ -1765,7 +1788,7 @@ public class PlayerController : MoveCharacter
|
|
|
velocity = Vector3.zero;
|
|
|
break;
|
|
|
case CharacterState.Die:
|
|
|
- if(isRevive)
|
|
|
+ if (isRevive)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
@@ -1775,7 +1798,7 @@ public class PlayerController : MoveCharacter
|
|
|
beRepelValue = totalBeRepelValue;
|
|
|
break;
|
|
|
case CharacterState.Conduct:
|
|
|
- rb.isKinematic =false;
|
|
|
+ rb.isKinematic = false;
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
@@ -2040,7 +2063,7 @@ public class PlayerController : MoveCharacter
|
|
|
{
|
|
|
prefab = demonicPrefabs[id];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (!CheckCanSummon(id))
|
|
|
{
|
|
|
return;
|
|
|
@@ -2087,12 +2110,12 @@ public class PlayerController : MoveCharacter
|
|
|
demonic.Init();
|
|
|
int order = prefab.GetComponent<Demonic>().baseSortingOrder + demonicDic[demonic.id].Count;
|
|
|
demonic.SetSortingOrder(order);
|
|
|
- if(id != 4)
|
|
|
+ if (id != 4)
|
|
|
{
|
|
|
demonic.Attack1();
|
|
|
}
|
|
|
//id 3~6 为四个英灵
|
|
|
- if(id >= 3 && id <= 6)
|
|
|
+ if (id >= 3 && id <= 6)
|
|
|
{
|
|
|
spirits.ultimateTimes[spirits.nowSpirit] -= 1;
|
|
|
}
|
|
|
@@ -2145,7 +2168,7 @@ public class PlayerController : MoveCharacter
|
|
|
{
|
|
|
prefab = demonicPrefabs[id];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
float costMp = prefab.GetComponent<Demonic>().costMp;
|
|
|
if (mp < costMp)
|
|
|
{
|