|
|
@@ -32,6 +32,7 @@ public class PlayerController : MoveCharacter
|
|
|
private SpiritSystem spiritSystem;
|
|
|
private ScreenShake ss;
|
|
|
private ConductController conductController;
|
|
|
+ [HideInInspector] public GameManager gameManager;
|
|
|
//
|
|
|
|
|
|
[FoldoutGroup("召唤属性", order:-1)] public float totalSummonTime;
|
|
|
@@ -280,9 +281,9 @@ public class PlayerController : MoveCharacter
|
|
|
public override void Init()
|
|
|
{
|
|
|
base.Init();
|
|
|
- uiHp = GameManager.instance.p1uiHP;
|
|
|
- uiMp = GameManager.instance.p1uiMP;
|
|
|
- uiRush = GameManager.instance.p1uiRush;
|
|
|
+ uiHp = gameManager.p1uiHP;
|
|
|
+ uiMp = gameManager.p1uiMP;
|
|
|
+ uiRush = gameManager.p1uiRush;
|
|
|
uiMp.pc = this;
|
|
|
mp = totalMp;
|
|
|
rushChargeNums = rushChargeTotalNums;
|
|
|
@@ -301,17 +302,18 @@ public class PlayerController : MoveCharacter
|
|
|
demonicNums = new TextMeshProUGUI[3];
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
{
|
|
|
- demonicNums[i] = GameManager.instance.demonicNum[i].GetComponentInChildren<TextMeshProUGUI>();
|
|
|
+ demonicNums[i] = gameManager.demonicNum[i].GetComponentInChildren<TextMeshProUGUI>();
|
|
|
}
|
|
|
cannotConductFXs = new GameObject[3];
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
{
|
|
|
- cannotConductFXs[i] = GameManager.instance.demonicNum[i].transform.GetChild(3).gameObject;
|
|
|
+ cannotConductFXs[i] = gameManager.demonicNum[i].transform.GetChild(3).gameObject;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public override void Awake()
|
|
|
{
|
|
|
+ gameManager = GameManager.instance;
|
|
|
base.Awake();
|
|
|
PlayerInput playerInput = transform.GetComponent<PlayerInput>();
|
|
|
ss = Camera.main.GetComponentInParent<ScreenShake>();
|
|
|
@@ -369,7 +371,7 @@ public class PlayerController : MoveCharacter
|
|
|
|
|
|
private void Start()
|
|
|
{
|
|
|
- slr = GameManager.instance.GetComponent<SoldierLevelRecord>();
|
|
|
+ slr = gameManager.GetComponent<SoldierLevelRecord>();
|
|
|
}
|
|
|
|
|
|
override public void Update()
|
|
|
@@ -525,7 +527,7 @@ public class PlayerController : MoveCharacter
|
|
|
}
|
|
|
if (state != CharacterState.Conduct
|
|
|
&& nowConductButton != -1
|
|
|
- && conductController.conductSkills[nowConductButton]!=ConductController.ConductSkills.Null
|
|
|
+ && conductController.conductSkills[nowConductButton] != ConductSkills.Null
|
|
|
&& conductTime > totalCacheSummonTime)
|
|
|
{
|
|
|
CheckTurn();
|
|
|
@@ -570,17 +572,17 @@ public class PlayerController : MoveCharacter
|
|
|
|
|
|
if (!isReadyConduct && nowConductButton != -1)
|
|
|
{
|
|
|
+ int boostNum = demonicDic[nowConductButton].Count;
|
|
|
+ int dienum = (int)(boostNum * conductController.conversionRate[nowConductButton]/100 + 0.5f);
|
|
|
+ if (boostNum == 1)
|
|
|
+ {
|
|
|
+ dienum = 1;
|
|
|
+ }
|
|
|
if (conductTime >= canConductTime[nowConductButton] * timeSlowingMultiplier)
|
|
|
{
|
|
|
isReadyConduct = true;
|
|
|
if (!conductReadyTip.isShowing1 && !conductReadyTip.isShowingNoDemonic)
|
|
|
{
|
|
|
- int boostNum = demonicDic[nowConductButton].Count;
|
|
|
- int dienum = (int)(boostNum * conductController.conversionRate[nowConductButton] + 0.5f);
|
|
|
- if (boostNum == 1)
|
|
|
- {
|
|
|
- dienum = 1;
|
|
|
- }
|
|
|
if (dienum > 0)
|
|
|
{
|
|
|
conductReadyTip.Show(1);
|
|
|
@@ -597,12 +599,6 @@ public class PlayerController : MoveCharacter
|
|
|
{
|
|
|
if (!conductReadyTip.isShowing0 && !conductReadyTip.isShowingNoDemonic)
|
|
|
{
|
|
|
- int boostNum = demonicDic[nowConductButton].Count;
|
|
|
- int dienum = (int)(boostNum * conductController.conversionRate[nowConductButton] + 0.5f);
|
|
|
- if (boostNum == 1)
|
|
|
- {
|
|
|
- dienum = 1;
|
|
|
- }
|
|
|
if (dienum > 0)
|
|
|
{
|
|
|
conductReadyTip.Show(0);
|
|
|
@@ -621,12 +617,6 @@ public class PlayerController : MoveCharacter
|
|
|
{
|
|
|
Time.timeScale = timeSlowingMultiplier;
|
|
|
Time.fixedDeltaTime = fixedDeltaTime * Time.timeScale;
|
|
|
- int boostNum = demonicDic[nowConductButton].Count;
|
|
|
- int dienum = (int)(boostNum * conductController.conversionRate[nowConductButton] + 0.5f);
|
|
|
- if (boostNum == 1)
|
|
|
- {
|
|
|
- dienum = 1;
|
|
|
- }
|
|
|
if (dienum == 0)
|
|
|
{
|
|
|
conductReadyTip.Show(2, nowConductButton);
|
|
|
@@ -1482,11 +1472,56 @@ public class PlayerController : MoveCharacter
|
|
|
}
|
|
|
mp -= costMp;
|
|
|
uiMp.Show(mp, totalMp);
|
|
|
- CreateDemonic(demonicPrefabs[id]);
|
|
|
+ Demonic demonic = CreateDemonic(id);
|
|
|
+ if (!demonicDic.ContainsKey(id))
|
|
|
+ {
|
|
|
+ demonicDic.Add(id, new List<Demonic>());
|
|
|
+ }
|
|
|
+ demonicDic[id].Add(demonic);
|
|
|
+ if (id <= 2)
|
|
|
+ {
|
|
|
+ demonicNums[id].text = demonicDic[id].Count.ToString();
|
|
|
+ }
|
|
|
+ int attackSummonId = nowAttackSummonID;
|
|
|
+
|
|
|
+ if (lastSoldier != demonic.soldierType)
|
|
|
+ {
|
|
|
+ attackSummonId = 0;
|
|
|
+ }
|
|
|
+ demonic.attackController.attackSummonId = attackSummonId;
|
|
|
+ onlySummonTime = demonic.attackController.summonTime[attackSummonId];
|
|
|
+ invincibleTime = onlySummonTime + addSummonInvincibleTime;
|
|
|
+ restSummonTime = onlySummonTime;
|
|
|
+ demonic.Attack_summon();
|
|
|
+ lastSoldier = demonic.soldierType;
|
|
|
+ attackSummonId++;
|
|
|
+ if (attackSummonId >= demonic.attackController.attackMethod_summon.Length)
|
|
|
+ {
|
|
|
+ attackSummonId = 0;
|
|
|
+ AttackSummonChangeTime = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ AttackSummonChangeTime = AttackSummonChangeTotalTime;
|
|
|
+ }
|
|
|
+ nowAttackSummonID = attackSummonId;
|
|
|
+ //id 3~6 为四个英灵
|
|
|
+ if (id >= 3)
|
|
|
+ {
|
|
|
+ spirits.ultimateTimes[id - 3] -= spirits.summonCost;
|
|
|
+ }
|
|
|
+ spiritSystem.RefreshPlayerUI();
|
|
|
+ if (isInSoulTower)
|
|
|
+ {
|
|
|
+ ls.AddDenomic(demonic);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public Demonic CreateDemonic(int id)
|
|
|
+ {
|
|
|
GameObject demonicObj = PoolManager.Instantiate(demonicPrefabs[id]);
|
|
|
Demonic demonic = demonicObj.GetComponent<Demonic>();
|
|
|
slr.SoldierAddLevelBuff(demonic);
|
|
|
- GameManager gameManager = GameManager.instance;
|
|
|
AttackController attackController = demonic.attackController;
|
|
|
for (int i = 0; i < attackController.attackMethod_summon.Length; i++)
|
|
|
{
|
|
|
@@ -1504,25 +1539,16 @@ public class PlayerController : MoveCharacter
|
|
|
}
|
|
|
demonic.attributeStatus.resistances.armor = gameManager.armor;
|
|
|
demonic.attributeStatus.resistances.dodge = gameManager.dodge;
|
|
|
- demonic.regeneration = GameManager.instance.regeneration;
|
|
|
+ demonic.regeneration = gameManager.regeneration;
|
|
|
demonic.totalHp += gameManager.totalHp;
|
|
|
demonic.id = id;
|
|
|
demonic.playerID = playerId;
|
|
|
- if (!demonicDic.ContainsKey(id))
|
|
|
- {
|
|
|
- demonicDic.Add(id, new List<Demonic>());
|
|
|
- }
|
|
|
- demonicDic[id].Add(demonic);
|
|
|
- if (id <= 2)
|
|
|
- {
|
|
|
- demonicNums[id].text = demonicDic[id].Count.ToString();
|
|
|
- }
|
|
|
demonicObj.transform.parent = null;
|
|
|
demonicObj.transform.localEulerAngles = Vector3.zero;
|
|
|
demonicObj.transform.localScale = new Vector3(1, 1, 1);
|
|
|
Vector3 offset = demonicSummonPos[id];
|
|
|
//demonic.CheckTurn(-bodyTrans.localScale.x);
|
|
|
- if(bodyTrans.localScale.x > 0)
|
|
|
+ if (bodyTrans.localScale.x > 0)
|
|
|
{
|
|
|
if (demonic.bodyTrans.localScale.x < 0)
|
|
|
{
|
|
|
@@ -1536,8 +1562,8 @@ public class PlayerController : MoveCharacter
|
|
|
demonic.Turn();
|
|
|
}
|
|
|
}
|
|
|
- demonicObj.transform.position = transform.position
|
|
|
- + new Vector3(bodyTrans.localScale.x > 0 ? offset.x: -offset.x, offset.y, offset.z);
|
|
|
+ demonicObj.transform.position = transform.position
|
|
|
+ + new Vector3(bodyTrans.localScale.x > 0 ? offset.x : -offset.x, offset.y, offset.z);
|
|
|
if (demonic.canFly)
|
|
|
{
|
|
|
demonic.flyHeight = demonic.transform.position.y;
|
|
|
@@ -1546,46 +1572,7 @@ public class PlayerController : MoveCharacter
|
|
|
demonic.Init();
|
|
|
int order = demonicPrefabs[id].GetComponent<Demonic>().baseSortingOrder + demonicDic[demonic.id].Count;
|
|
|
demonic.SetSortingOrder(order);
|
|
|
-
|
|
|
- int attackSummonId = nowAttackSummonID;
|
|
|
-
|
|
|
- if (lastSoldier != demonic.soldierType)
|
|
|
- {
|
|
|
- attackSummonId = 0;
|
|
|
- }
|
|
|
- demonic.attackController.attackSummonId = attackSummonId;
|
|
|
- onlySummonTime = demonic.attackController.summonTime[attackSummonId];
|
|
|
- invincibleTime = onlySummonTime + addSummonInvincibleTime;
|
|
|
- restSummonTime = onlySummonTime;
|
|
|
- demonic.Attack_summon();
|
|
|
- lastSoldier = demonic.soldierType;
|
|
|
- attackSummonId++;
|
|
|
- if (attackSummonId >= demonic.attackController.attackMethod_summon.Length)
|
|
|
- {
|
|
|
- attackSummonId = 0;
|
|
|
- AttackSummonChangeTime = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- AttackSummonChangeTime = AttackSummonChangeTotalTime;
|
|
|
- }
|
|
|
- nowAttackSummonID = attackSummonId;
|
|
|
- //id 3~6 为四个英灵
|
|
|
- if (id >= 3)
|
|
|
- {
|
|
|
- spirits.ultimateTimes[id - 3] -= spirits.summonCost;
|
|
|
- }
|
|
|
- spiritSystem.RefreshPlayerUI();
|
|
|
- if (isInSoulTower)
|
|
|
- {
|
|
|
- ls.AddDenomic(demonic);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public void CreateDemonic(GameObject prefab)
|
|
|
- {
|
|
|
-
|
|
|
+ return demonic;
|
|
|
}
|
|
|
public void OnDemonicRecycle(Demonic demonic)
|
|
|
{
|