|
|
@@ -28,6 +28,7 @@ public class PlayerController : MoveCharacter
|
|
|
public SkeletonMecanim skeletonMecanim;
|
|
|
private SpiritSystem spiritSystem;
|
|
|
private ScreenShake ss;
|
|
|
+ private ConductController conductController;
|
|
|
|
|
|
[Header("蓝耗")]
|
|
|
public float mp;
|
|
|
@@ -126,22 +127,13 @@ public class PlayerController : MoveCharacter
|
|
|
private int cacheConductId;
|
|
|
[Header("召唤相应时间")] [Tooltip("在此时间内松手为召唤")] public float totalCacheSummonTime;
|
|
|
[Header("融魂相应时间")] [Tooltip("在此时间以外松手为融魂")] public float[] canConductTime;
|
|
|
- [Header("融魂技")] [Tooltip("选择相应的融魂技能")] public ConductSkills[] conductSkills;
|
|
|
public bool[] conductCanRelease; //能否进入指挥技蓄力状态
|
|
|
public ConductReadyTip conductReadyTip; //指挥技就绪
|
|
|
private bool isReadyConduct;
|
|
|
[Header("时间倍率")] [Tooltip("时间速度放慢到正常的几倍")] public float timeSlowingMultiplier;
|
|
|
[DisplayOnly]public float fixedDeltaTime;
|
|
|
public float readyTipFxTime;
|
|
|
- [Header("转换率")] public float[] conversionRate;
|
|
|
- //大胖子
|
|
|
- [Header("融合临时血量基数")] public int temptHp;
|
|
|
- [Header("融合血量持续时间")] public float temptTime;
|
|
|
- public GameObject[] bigGiant;
|
|
|
-
|
|
|
- //光球
|
|
|
- public GameObject photosphereObj;
|
|
|
- [Header("光球血量基数")] public int photosphereHp;
|
|
|
+
|
|
|
//攻击力
|
|
|
[Header("增加攻击力特效")]
|
|
|
public GameObject attackEffect;
|
|
|
@@ -166,21 +158,6 @@ public class PlayerController : MoveCharacter
|
|
|
[Header("飞剑角度入射角")] public float flyintSwordsArrivalAngle;
|
|
|
[Header("飞剑数量基数")] public int flyingSwordsNum;
|
|
|
|
|
|
- public enum ConductSkills
|
|
|
- {
|
|
|
- Giant, //胖子:合成大胖子
|
|
|
- Photosphere, //胖子:光球
|
|
|
- AddAttack, //胖子:增加攻击力
|
|
|
-
|
|
|
- Mountain, //气功师:泰山压顶
|
|
|
- WavePower, //气功师:气功波
|
|
|
- SwordsControl, //气功师:御剑术
|
|
|
-
|
|
|
- AngryBullet, //弓箭手:怨气弹
|
|
|
- FlyingSwords, //扇形飞剑
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
public bool btnJumpPress
|
|
|
{
|
|
|
get
|
|
|
@@ -367,6 +344,7 @@ public class PlayerController : MoveCharacter
|
|
|
PlayerInput playerInput = transform.GetComponent<PlayerInput>();
|
|
|
ss = Camera.main.GetComponentInParent<ScreenShake>();
|
|
|
spirits = GetComponent<Spirits>();
|
|
|
+ conductController = GetComponent<ConductController>();
|
|
|
playerId = playerInput.playerIndex;
|
|
|
transform.position = new Vector3(pos.x, pos.y, 0);
|
|
|
switch (playerId)
|
|
|
@@ -592,7 +570,7 @@ public class PlayerController : MoveCharacter
|
|
|
{
|
|
|
if (isReadyConduct)
|
|
|
{
|
|
|
- Conduct();
|
|
|
+ conductController.Conduct(cacheConductId);
|
|
|
}
|
|
|
isReadyConduct = false;
|
|
|
return true;
|
|
|
@@ -606,7 +584,7 @@ public class PlayerController : MoveCharacter
|
|
|
if (!conductReadyTip.isShowing1 && !conductReadyTip.isShowingNoDemonic)
|
|
|
{
|
|
|
int boostNum = demonicDic[nowConductButton].Count;
|
|
|
- int dienum = Mathf.RoundToInt(boostNum * conversionRate[nowConductButton]);
|
|
|
+ int dienum = (int)(boostNum * conductController.conversionRate[nowConductButton] + 0.5f);
|
|
|
if (boostNum == 1)
|
|
|
{
|
|
|
dienum = 1;
|
|
|
@@ -628,7 +606,7 @@ public class PlayerController : MoveCharacter
|
|
|
if (!conductReadyTip.isShowing0 && !conductReadyTip.isShowingNoDemonic)
|
|
|
{
|
|
|
int boostNum = demonicDic[nowConductButton].Count;
|
|
|
- int dienum = Mathf.RoundToInt(boostNum * conversionRate[nowConductButton]);
|
|
|
+ int dienum = (int)(boostNum * conductController.conversionRate[nowConductButton] + 0.5f);
|
|
|
if (boostNum == 1)
|
|
|
{
|
|
|
dienum = 1;
|
|
|
@@ -652,7 +630,7 @@ public class PlayerController : MoveCharacter
|
|
|
Time.timeScale = timeSlowingMultiplier;
|
|
|
Time.fixedDeltaTime = fixedDeltaTime * Time.timeScale;
|
|
|
int boostNum = demonicDic[nowConductButton].Count;
|
|
|
- int dienum = Mathf.RoundToInt(boostNum * conversionRate[nowConductButton]);
|
|
|
+ int dienum = (int)(boostNum * conductController.conversionRate[nowConductButton] + 0.5f);
|
|
|
if (boostNum == 1)
|
|
|
{
|
|
|
dienum = 1;
|
|
|
@@ -671,173 +649,92 @@ public class PlayerController : MoveCharacter
|
|
|
|
|
|
public void Conduct()
|
|
|
{
|
|
|
- int boostNum = demonicDic[cacheConductId].Count;
|
|
|
- int dienum = Mathf.RoundToInt(boostNum * conversionRate[cacheConductId]);
|
|
|
- if (dienum == 0 && boostNum >= 1)
|
|
|
- {
|
|
|
- dienum = 1;
|
|
|
- }
|
|
|
- if (dienum > 0)
|
|
|
- {
|
|
|
- GameObject obj;
|
|
|
- List<int> dieId = new List<int>();
|
|
|
- List<Demonic> dieDemonic = new List<Demonic>();
|
|
|
- while (dieId.Count < dienum)
|
|
|
- {
|
|
|
- int id = UnityEngine.Random.Range(0, boostNum);
|
|
|
- if (!dieId.Exists(t => t == id))
|
|
|
- {
|
|
|
- dieId.Add(id);
|
|
|
- dieDemonic.Add(demonicDic[cacheConductId][id]);
|
|
|
- }
|
|
|
- }
|
|
|
- foreach (Demonic d in dieDemonic)
|
|
|
- {
|
|
|
- d.ChangeState(CharacterState.Die);
|
|
|
- }
|
|
|
- switch (conductSkills[cacheConductId])
|
|
|
- {
|
|
|
- //巨人
|
|
|
- case ConductSkills.Giant:
|
|
|
- GameObject demonicObj = PoolManager.Instantiate(bigGiant[cacheConductId]);
|
|
|
- demonicObj.SetActive(false);
|
|
|
- BigSoldier bs = demonicObj.GetComponent<BigSoldier>();
|
|
|
- bs.id = cacheConductId + 3;
|
|
|
- demonicDic[bs.id].Add(bs);
|
|
|
- if(bs.id < 3)
|
|
|
- {
|
|
|
- demonicNums[bs.id].text = demonicDic[bs.id].Count.ToString();
|
|
|
- }
|
|
|
- int tempthp = boostNum * temptHp;
|
|
|
- bs.playerID = playerId;
|
|
|
- demonicObj.transform.parent = null;
|
|
|
- demonicObj.transform.localEulerAngles = Vector3.zero;
|
|
|
- bs.boostNum = boostNum;
|
|
|
- if (isInSoulTower)
|
|
|
- {
|
|
|
- ls.AddDenomic(bs);
|
|
|
- }
|
|
|
- bs.player = this;
|
|
|
- bs.Settings();
|
|
|
- bs.GetTemptHP(tempthp, temptTime);
|
|
|
- int order = bs.baseSortingOrder + demonicDic[bs.id].Count;
|
|
|
- bs.SetSortingOrder(order);
|
|
|
- Vector3 offset = demonicSummonPos[0] * 2;
|
|
|
- if (bodyTrans.localScale.x > 0)
|
|
|
- {
|
|
|
- demonicObj.transform.position = transform.position + offset;
|
|
|
- if (bs.bodyTrans.localScale.x < 0)
|
|
|
- {
|
|
|
- bs.Turn();
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- demonicObj.transform.position = transform.position + new Vector3(-offset.x, offset.y, offset.z);
|
|
|
- if (bs.bodyTrans.localScale.x > 0)
|
|
|
- {
|
|
|
- bs.Turn();
|
|
|
- }
|
|
|
- }
|
|
|
- demonicObj.SetActive(true);
|
|
|
- break;
|
|
|
- case ConductSkills.Photosphere:
|
|
|
- conductCanRelease[cacheConductId] = false;
|
|
|
- obj = Instantiate(photosphereObj, transform);
|
|
|
- obj.transform.position = transform.position + Vector3.up;
|
|
|
- Photosphere photosphere = obj.GetComponent<Photosphere>();
|
|
|
- photosphere.owner = this;
|
|
|
- photosphere.conductId = cacheConductId;
|
|
|
- photosphere.hp = boostNum * photosphereHp;
|
|
|
- break;
|
|
|
- case ConductSkills.AddAttack:
|
|
|
- List<Demonic> newGiants = new List<Demonic>();
|
|
|
- foreach (Demonic d in demonicDic[cacheConductId])
|
|
|
- {
|
|
|
- if (!d.isDie)
|
|
|
- {
|
|
|
- newGiants.Add(d);
|
|
|
- if (d.attackController.addAttackEffect == null)
|
|
|
- {
|
|
|
- d.attackController.addAttackEffect = Instantiate(attackEffect, d.bodyTrans.position, new Quaternion(0, 0, 0, 0), d.bodyTrans);
|
|
|
- }
|
|
|
- d.attackController.addAttackEffect.transform.GetChild(0).gameObject.SetActive(true);
|
|
|
- }
|
|
|
- }
|
|
|
- foreach (Demonic d in newGiants)
|
|
|
- {
|
|
|
- int damage = d.attackController.curDamage;
|
|
|
- d.attackController.curDamage += (int)(addRate * boostNum * damage);
|
|
|
- }
|
|
|
- break;
|
|
|
- //气功师
|
|
|
- case ConductSkills.Mountain:
|
|
|
- conductCanRelease[cacheConductId] = false;
|
|
|
- GameObject curMountain = Instantiate(mountain, null);
|
|
|
- Vector3 moffset = mountainOffset;
|
|
|
- Vector3 sc = curMountain.transform.localScale;
|
|
|
- sc.x = largeX * dienum;
|
|
|
- curMountain.transform.localScale = sc;
|
|
|
- if (bodyTrans.localScale.x < 0)
|
|
|
- {
|
|
|
- moffset.x = mountainOffset.x + sc.x / 2;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- moffset.x = -mountainOffset.x - sc.x / 2;
|
|
|
- }
|
|
|
- Mountain MT = curMountain.GetComponent<Mountain>();
|
|
|
- curMountain.transform.position = transform.position + moffset;
|
|
|
- MT.pc = this;
|
|
|
- MT.id = cacheConductId;
|
|
|
- MT.demonicNum = boostNum;
|
|
|
- break;
|
|
|
- case ConductSkills.WavePower:
|
|
|
- rb.constraints = RigidbodyConstraints.FreezeAll;
|
|
|
- rb.useGravity = false;
|
|
|
- conductCanRelease[cacheConductId] = false;
|
|
|
- obj = Instantiate(wavePowerObj, transform);
|
|
|
- obj.transform.position = transform.position + Vector3.up;
|
|
|
- WavePowerSkill wps = obj.GetComponent<WavePowerSkill>();
|
|
|
- wps.continueTime = wps.singleTime * dienum;
|
|
|
- wps.longFX = (int)bodyTrans.localScale.x;
|
|
|
- wps.damage = wavePowerDamage * boostNum;
|
|
|
- wps.cacheID = cacheConductId;
|
|
|
- wps.pc = this;
|
|
|
- break;
|
|
|
- case ConductSkills.SwordsControl:
|
|
|
- conductCanRelease[cacheConductId] = false;
|
|
|
- obj = Instantiate(flyingSwordsObj, transform);
|
|
|
- obj.transform.position = transform.position + Vector3.up;
|
|
|
- SwordsControl swordsControl = obj.GetComponentInChildren<SwordsControl>();
|
|
|
- swordsControl.owner = this;
|
|
|
- swordsControl.conductId = cacheConductId;
|
|
|
- swordsControl.boostNum = boostNum;
|
|
|
- break;
|
|
|
- //弓箭手
|
|
|
- case ConductSkills.AngryBullet:
|
|
|
- conductCanRelease[cacheConductId] = false;
|
|
|
- obj = Instantiate(angryBulletObj);
|
|
|
- AngryBulletControl angryBulletControl = obj.GetComponent<AngryBulletControl>();
|
|
|
- angryBulletControl.playerController = this;
|
|
|
- angryBulletControl.cacheConductId = cacheConductId;
|
|
|
- angryBulletControl.maxNum = boostNum * angryBulletNum;
|
|
|
- break;
|
|
|
- case ConductSkills.FlyingSwords:
|
|
|
- obj = Instantiate(fanFlyingSwords);
|
|
|
- FanFlyingSwords FFS = obj.GetComponent<FanFlyingSwords>();
|
|
|
- FFS.owner = this;
|
|
|
- FFS.angleRange = flyingSwordsAngleRange;
|
|
|
- FFS.arrivalAngle = flyintSwordsArrivalAngle;
|
|
|
- FFS.swordsNum = boostNum * flyingSwordsNum;
|
|
|
- FFS.Biu();
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- print("使魔不足");
|
|
|
- }
|
|
|
+ //switch (conductSkills[cacheConductId])
|
|
|
+ //{
|
|
|
+ // //巨人
|
|
|
+ // case ConductSkills.AddAttack:
|
|
|
+ // List<Demonic> newGiants = new List<Demonic>();
|
|
|
+ // foreach (Demonic d in demonicDic[cacheConductId])
|
|
|
+ // {
|
|
|
+ // if (!d.isDie)
|
|
|
+ // {
|
|
|
+ // newGiants.Add(d);
|
|
|
+ // if (d.attackController.addAttackEffect == null)
|
|
|
+ // {
|
|
|
+ // d.attackController.addAttackEffect = Instantiate(attackEffect, d.bodyTrans.position, new Quaternion(0, 0, 0, 0), d.bodyTrans);
|
|
|
+ // }
|
|
|
+ // d.attackController.addAttackEffect.transform.GetChild(0).gameObject.SetActive(true);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // foreach (Demonic d in newGiants)
|
|
|
+ // {
|
|
|
+ // int damage = d.attackController.curDamage;
|
|
|
+ // d.attackController.curDamage += (int)(addRate * boostNum * damage);
|
|
|
+ // }
|
|
|
+ // break;
|
|
|
+ // //气功师
|
|
|
+ // case ConductSkills.Mountain:
|
|
|
+ // conductCanRelease[cacheConductId] = false;
|
|
|
+ // GameObject curMountain = Instantiate(mountain, null);
|
|
|
+ // Vector3 moffset = mountainOffset;
|
|
|
+ // Vector3 sc = curMountain.transform.localScale;
|
|
|
+ // sc.x = largeX * dienum;
|
|
|
+ // curMountain.transform.localScale = sc;
|
|
|
+ // if (bodyTrans.localScale.x < 0)
|
|
|
+ // {
|
|
|
+ // moffset.x = mountainOffset.x + sc.x / 2;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // moffset.x = -mountainOffset.x - sc.x / 2;
|
|
|
+ // }
|
|
|
+ // Mountain MT = curMountain.GetComponent<Mountain>();
|
|
|
+ // curMountain.transform.position = transform.position + moffset;
|
|
|
+ // MT.pc = this;
|
|
|
+ // MT.id = cacheConductId;
|
|
|
+ // MT.demonicNum = boostNum;
|
|
|
+ // break;
|
|
|
+ // case ConductSkills.WavePower:
|
|
|
+ // rb.constraints = RigidbodyConstraints.FreezeAll;
|
|
|
+ // rb.useGravity = false;
|
|
|
+ // conductCanRelease[cacheConductId] = false;
|
|
|
+ // obj = Instantiate(wavePowerObj, transform);
|
|
|
+ // obj.transform.position = transform.position + Vector3.up;
|
|
|
+ // WavePowerSkill wps = obj.GetComponent<WavePowerSkill>();
|
|
|
+ // wps.continueTime = wps.singleTime * dienum;
|
|
|
+ // wps.longFX = (int)bodyTrans.localScale.x;
|
|
|
+ // wps.damage = wavePowerDamage * boostNum;
|
|
|
+ // wps.cacheID = cacheConductId;
|
|
|
+ // wps.pc = this;
|
|
|
+ // break;
|
|
|
+ // case ConductSkills.SwordsControl:
|
|
|
+ // conductCanRelease[cacheConductId] = false;
|
|
|
+ // obj = Instantiate(flyingSwordsObj, transform);
|
|
|
+ // obj.transform.position = transform.position + Vector3.up;
|
|
|
+ // SwordsControl swordsControl = obj.GetComponentInChildren<SwordsControl>();
|
|
|
+ // swordsControl.owner = this;
|
|
|
+ // swordsControl.conductId = cacheConductId;
|
|
|
+ // swordsControl.boostNum = boostNum;
|
|
|
+ // break;
|
|
|
+ // //弓箭手
|
|
|
+ // case ConductSkills.AngryBullet:
|
|
|
+ // conductCanRelease[cacheConductId] = false;
|
|
|
+ // obj = Instantiate(angryBulletObj);
|
|
|
+ // AngryBulletControl angryBulletControl = obj.GetComponent<AngryBulletControl>();
|
|
|
+ // angryBulletControl.playerController = this;
|
|
|
+ // angryBulletControl.cacheConductId = cacheConductId;
|
|
|
+ // angryBulletControl.maxNum = boostNum * angryBulletNum;
|
|
|
+ // break;
|
|
|
+ // case ConductSkills.FlyingSwords:
|
|
|
+ // obj = Instantiate(fanFlyingSwords);
|
|
|
+ // FanFlyingSwords FFS = obj.GetComponent<FanFlyingSwords>();
|
|
|
+ // FFS.owner = this;
|
|
|
+ // FFS.angleRange = flyingSwordsAngleRange;
|
|
|
+ // FFS.arrivalAngle = flyintSwordsArrivalAngle;
|
|
|
+ // FFS.swordsNum = boostNum * flyingSwordsNum;
|
|
|
+ // FFS.Biu();
|
|
|
+ // break;
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
private int cannotConductfx;
|