WGL 1 hónapja
szülő
commit
032a58e4f3
1 módosított fájl, 142 hozzáadás és 169 törlés
  1. 142 169
      ActionTowerDefense/Assets/Scripts/Conduct/ConductController.cs

+ 142 - 169
ActionTowerDefense/Assets/Scripts/Conduct/ConductController.cs

@@ -23,17 +23,6 @@ public class ConductController : MonoBehaviour
     [LabelText("融魂技")] public ConductSkills[] conductSkills;
 
     public Photosphere photosphere;
-    [Serializable] public struct Giant
-    {
-        public GameObject bigGiant;
-        [LabelText("临时血量基数")]
-        public int temptHp;
-        [LabelText("临时血量持续时间")] 
-        public float temptTime;
-    }
-    private bool ShowGiant() => conductSkills.Contains(ConductSkills.Giant);
-    [ShowIf("ShowGiant")][LabelText("合成大胖子参数")]
-    public Giant giant;
     
     private void Awake()
     {
@@ -74,6 +63,13 @@ public class ConductController : MonoBehaviour
                     sacrificeValue[i] = barrier.sacrificeValue[demonicRarity];
                     totalCD[i] = barrier.cd[demonicRarity];
                     break;
+                case ConductSkills.SpiritBloodAggregator:
+                    ConductManager.SpiritBloodAggregator spiritBloodAggregator = conductManager.spiritBloodAggregator;
+                    bUseFixedSacrifice[i] = spiritBloodAggregator.bUseFixedSacrifice;
+                    conversionRate[i] = spiritBloodAggregator.sacrificeRatio[demonicRarity];
+                    sacrificeValue[i] = spiritBloodAggregator.sacrificeValue[demonicRarity];
+                    totalCD[i] = spiritBloodAggregator.cd[demonicRarity];
+                    break;
             }
         }
     }
@@ -100,174 +96,151 @@ public class ConductController : MonoBehaviour
             }
         }
     }
-    public void Conduct(int demonicId)
+    public void Conduct(int demonicId, int dienum)
     {
-        int boostNum = playerController.demonicDic[demonicId].Count;
-        int dienum;
-        if (bUseFixedSacrifice[demonicId])
+        if (!bUseFixedSacrifice[demonicId])
         {
-            dienum = sacrificeValue[demonicId];
-            if (boostNum < dienum)
-            {
-                dienum = 0;
-            }
+            cd[demonicId] = totalCD[demonicId];
         }
-        else
+        GameObject obj;
+        List<int> dieId = new List<int>();
+        List<Demonic> dieDemonic = new List<Demonic>();
+        List<Demonic> playerDemonic = playerController.demonicDic[demonicId];
+        List<Demonic> demonicDic = new List<Demonic>(playerDemonic);
+        for (int i = 0; i < dienum; i++)
         {
-            dienum = (int)(boostNum * conversionRate[demonicId] / 100 + 0.5f);
-            if (dienum == 0 && boostNum >= 1)
-            {
-                dienum = 1;
-            }
+            if (i >= playerDemonic.Count) break;
+            int id = UnityEngine.Random.Range(0, demonicDic.Count);
+            dieId.Add(id);
+            dieDemonic.Add(demonicDic[id]);
+            demonicDic.RemoveAt(id);
         }
-
-
-        if (dienum > 0)
+        foreach (Demonic d in dieDemonic)
         {
-            if (!bUseFixedSacrifice[demonicId])
-            {
-                cd[demonicId] = totalCD[demonicId];
-            }
-            GameObject obj;
-            List<int> dieId = new List<int>();
-            List<Demonic> dieDemonic = new List<Demonic>();
-            List<Demonic> playerDemonic = playerController.demonicDic[demonicId];
-            List<Demonic> demonicDic = new List<Demonic>(playerDemonic);
-            for(int i = 0; i < dienum; i++)
-            {
-                int id = UnityEngine.Random.Range(0, demonicDic.Count);
-                dieId.Add(id);
-                dieDemonic.Add(demonicDic[id]);
-                demonicDic.RemoveAt(id);
-            }
-            foreach (Demonic d in dieDemonic)
-            {
-                d.ChangeState(CharacterState.Die);
-            }
-            Demonic prefabDemonic = playerController.demonicPrefabs[demonicId].GetComponent<Demonic>();
-            SoldierLevelRecord.SoldierExtraBuff soldierExtraBuff = soldierLevelRecord.seb[demonicId];
-            int attackDamage = prefabDemonic.attackController.attackMethod_summon[0].attackInfo.damage
-                + soldierExtraBuff.summonAttack
-                + gameManager.damage;
-            List<int> myTreasureTag = gameManager.myTreasuresTag;
-            float tagAdd = 1;
-            int demonicRarity = rarity[demonicId];
-            switch (conductSkills[demonicId])
-            {
-                case ConductSkills.NetherfireRebirth:
-                    ConductManager.NetherfireRebirth netherfireRebirth = conductManager.netherfireRebirth;
-                    for (int i = 0;i<dienum * netherfireRebirth.power[demonicRarity]; i++)
-                    {
-                        Demonic demonic = playerController.CreateDemonic(demonicId);
-                        playerDemonic.Add(demonic);
-                        playerController.demonicNums[demonicId].text = playerDemonic.Count.ToString();
-                        if (netherfireRebirth.canDie)
-                        {
-                            demonic.summonEndToDie = true;
-                        }
-                        Vector3 targetPos = transform.position + new Vector3(
-                            UnityEngine.Random.Range(-netherfireRebirth.randomRange.x / 2, netherfireRebirth.randomRange.x / 2),
-                            UnityEngine.Random.Range(-netherfireRebirth.randomRange.y / 2, netherfireRebirth.randomRange.y / 2),
-                            0);
-                        if (targetPos.y < 0)
-                        {
-                            targetPos.y = 0;
-                        }
-                        demonic.gameObject.transform.position = targetPos;
-                        demonic.attackController.attackSummonId = 0;
-                        tagAdd += netherfireRebirth.effectBonus[demonicRarity] * myTreasureTag [(int)netherfireRebirth.attributeTag - 1]/ 100;
-                        int damage = demonic.attackController.attackMethod_summon[0].attackInfo.damage;
-                        damage = (int)(damage * tagAdd);
-                        demonic.attackController.attackMethod_summon[0].attackInfo.damage = damage;
-                        demonic.Attack_summon();
-                        playerController.lastSoldier = SoldierType.Conduct;
-                    }
-                    break;
-                case ConductSkills.FlyingSwords:
-                    ConductManager.FlyingSwords flyingSwords = conductManager.flyingSwords;
-                    obj = PoolManager.Instantiate(flyingSwords.obj);
-                    FanFlyingSwords FFS = obj.GetComponent<FanFlyingSwords>();
-                    FFS.owner = playerController;
-                    FFS.swordsNum = dienum * flyingSwords.power[demonicRarity];
-                    tagAdd += flyingSwords.effectBonus[demonicRarity] * myTreasureTag[(int)flyingSwords.attributeTag - 1] / 100;
-                    FFS.damage = (int)(attackDamage * tagAdd);
-                    FFS.Biu();
-                    break;
-                case ConductSkills.IceRain:
-                    ConductManager.IceRain iceRain = conductManager.iceRain;
-                    obj = PoolManager.Instantiate(iceRain.obj);
-                    IceRainController iceRainController = obj.GetComponent<IceRainController>();
-                    iceRainController.owner = playerController;
-                    iceRainController.swordsNum = dienum * iceRain.power[demonicRarity];
-                    tagAdd += iceRain.effectBonus[demonicRarity] * myTreasureTag[(int)iceRain.attributeTag - 1] / 100;
-                    iceRainController.damage = (int)(attackDamage * tagAdd);
-                    iceRainController.Biu();
-                    break;
-                case ConductSkills.Barrier:
-                    ConductManager.Barrier barrier = conductManager.barrier;
-                    Photosphere photosphere;
-                    if (this.photosphere)
-                    {
-                        obj = this.photosphere.gameObject;
-                        photosphere = this.photosphere;
-                    }
-                    else
-                    {
-                        obj = PoolManager.Instantiate(barrier.obj);
-                        obj.transform.parent = transform;
-                        photosphere = obj.GetComponent<Photosphere>();
-                        this.photosphere = photosphere;
-                    }
-                    obj.transform.position = transform.position + Vector3.up;
-                    photosphere.hp = prefabDemonic.totalHp + soldierExtraBuff.hp + gameManager.totalHp;
-                    photosphere.conductController = this;
-                    break;
-                /*胖子*/
-                //融合大胖子
-                case ConductSkills.Giant:
-                    GameObject demonicObj = PoolManager.Instantiate(giant.bigGiant);
-                    BigSoldier bs = demonicObj.GetComponent<BigSoldier>();
-                    bs.id = demonicId + 3;
-                    playerController.demonicDic[bs.id].Add(bs);
-                    if (bs.id < 3)
-                    {
-                        playerController.demonicNums[bs.id].text = playerController.demonicDic[bs.id].Count.ToString();
-                    }
-                    int tempthp = boostNum * giant.temptHp;
-                    bs.playerID = playerController.playerId;
-                    demonicObj.transform.parent = null;
-                    demonicObj.transform.localEulerAngles = Vector3.zero;
-                    bs.boostNum = boostNum;
-                    if (playerController.isInSoulTower)
-                    {
-                        playerController.ls.AddDenomic(bs);
-                    }
-                    bs.player = playerController;
-                    bs.Settings();
-                    bs.GetTemptHP(tempthp, giant.temptTime);
-                    int order = bs.baseSortingOrder + playerController.demonicDic[bs.id].Count;
-                    bs.SetSortingOrder(order);
-                    Vector3 offset = playerController.demonicSummonPos[0] * 2;
-                    if (playerController.bodyTrans.localScale.x > 0)
+            d.ChangeState(CharacterState.Die);
+        }
+        Demonic prefabDemonic = playerController.demonicPrefabs[demonicId].GetComponent<Demonic>();
+        SoldierLevelRecord.SoldierExtraBuff soldierExtraBuff = soldierLevelRecord.seb[demonicId];
+        int attackDamage = prefabDemonic.attackController.attackMethod_summon[0].attackInfo.damage
+            + soldierExtraBuff.summonAttack
+            + gameManager.damage;
+        List<int> myTreasureTag = gameManager.myTreasuresTag;
+        float tagAdd = 1;
+        int demonicRarity = rarity[demonicId];
+        switch (conductSkills[demonicId])
+        {
+            case ConductSkills.NetherfireRebirth:
+                ConductManager.NetherfireRebirth netherfireRebirth = conductManager.netherfireRebirth;
+                for (int i = 0; i < dienum * netherfireRebirth.power[demonicRarity]; i++)
+                {
+                    Demonic demonic = playerController.CreateDemonic(demonicId);
+                    playerDemonic.Add(demonic);
+                    playerController.demonicNums[demonicId].text = playerDemonic.Count.ToString();
+                    if (netherfireRebirth.canDie)
                     {
-                        demonicObj.transform.position = transform.position + offset;
-                        if (bs.bodyTrans.localScale.x < 0)
-                        {
-                            bs.Turn();
-                        }
+                        demonic.summonEndToDie = true;
                     }
-                    else
+                    Vector3 targetPos = transform.position + new Vector3(
+                        UnityEngine.Random.Range(-netherfireRebirth.randomRange.x / 2, netherfireRebirth.randomRange.x / 2),
+                        UnityEngine.Random.Range(-netherfireRebirth.randomRange.y / 2, netherfireRebirth.randomRange.y / 2),
+                        0);
+                    if (targetPos.y < 0)
                     {
-                        demonicObj.transform.position = transform.position + new Vector3(-offset.x, offset.y, offset.z);
-                        if (bs.bodyTrans.localScale.x > 0)
-                        {
-                            bs.Turn();
-                        }
+                        targetPos.y = 0;
                     }
-                    bs.Attack_summon();
-                    demonicObj.SetActive(true);
-                    break;
-            }
+                    demonic.gameObject.transform.position = targetPos;
+                    demonic.attackController.attackSummonId = 0;
+                    tagAdd += netherfireRebirth.effectBonus[demonicRarity] * myTreasureTag[(int)netherfireRebirth.attributeTag - 1] / 100;
+                    int damage = demonic.attackController.attackMethod_summon[0].attackInfo.damage;
+                    damage = (int)(damage * tagAdd);
+                    demonic.attackController.attackMethod_summon[0].attackInfo.damage = damage;
+                    demonic.Attack_summon();
+                    playerController.lastSoldier = SoldierType.Conduct;
+                }
+                break;
+            case ConductSkills.FlyingSwords:
+                ConductManager.FlyingSwords flyingSwords = conductManager.flyingSwords;
+                obj = PoolManager.Instantiate(flyingSwords.obj);
+                FanFlyingSwords FFS = obj.GetComponent<FanFlyingSwords>();
+                FFS.owner = playerController;
+                FFS.swordsNum = dienum * flyingSwords.power[demonicRarity];
+                tagAdd += flyingSwords.effectBonus[demonicRarity] * myTreasureTag[(int)flyingSwords.attributeTag - 1] / 100;
+                FFS.damage = (int)(attackDamage * tagAdd);
+                FFS.Biu();
+                break;
+            case ConductSkills.IceRain:
+                ConductManager.IceRain iceRain = conductManager.iceRain;
+                obj = PoolManager.Instantiate(iceRain.obj);
+                IceRainController iceRainController = obj.GetComponent<IceRainController>();
+                iceRainController.owner = playerController;
+                iceRainController.swordsNum = dienum * iceRain.power[demonicRarity];
+                tagAdd += iceRain.effectBonus[demonicRarity] * myTreasureTag[(int)iceRain.attributeTag - 1] / 100;
+                iceRainController.damage = (int)(attackDamage * tagAdd);
+                iceRainController.Biu();
+                break;
+            case ConductSkills.Barrier:
+                ConductManager.Barrier barrier = conductManager.barrier;
+                Photosphere photosphere;
+                if (this.photosphere)
+                {
+                    obj = this.photosphere.gameObject;
+                    photosphere = this.photosphere;
+                }
+                else
+                {
+                    obj = PoolManager.Instantiate(barrier.obj);
+                    obj.transform.parent = transform;
+                    photosphere = obj.GetComponent<Photosphere>();
+                    this.photosphere = photosphere;
+                }
+                obj.transform.position = transform.position + Vector3.up;
+                photosphere.hp = prefabDemonic.totalHp + soldierExtraBuff.hp + gameManager.totalHp;
+                photosphere.conductController = this;
+                break;
+            case ConductSkills.SpiritBloodAggregator:
+                ConductManager.SpiritBloodAggregator spiritBloodAggregator = conductManager.spiritBloodAggregator;
+                //GameObject demonicObj = PoolManager.Instantiate(giant.bigGiant);
+                //BigSoldier bs = demonicObj.GetComponent<BigSoldier>();
+                //bs.id = demonicId + 3;
+                //playerController.demonicDic[bs.id].Add(bs);
+                //if (bs.id < 3)
+                //{
+                //    playerController.demonicNums[bs.id].text = playerController.demonicDic[bs.id].Count.ToString();
+                //}
+                //int tempthp = boostNum * giant.temptHp;
+                //bs.playerID = playerController.playerId;
+                //demonicObj.transform.parent = null;
+                //demonicObj.transform.localEulerAngles = Vector3.zero;
+                //bs.boostNum = boostNum;
+                //if (playerController.isInSoulTower)
+                //{
+                //    playerController.ls.AddDenomic(bs);
+                //}
+                //bs.player = playerController;
+                //bs.Settings();
+                //bs.GetTemptHP(tempthp, giant.temptTime);
+                //int order = bs.baseSortingOrder + playerController.demonicDic[bs.id].Count;
+                //bs.SetSortingOrder(order);
+                //Vector3 offset = playerController.demonicSummonPos[0] * 2;
+                //if (playerController.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();
+                //    }
+                //}
+                //bs.Attack_summon();
+                //demonicObj.SetActive(true);
+                break;
         }
     }
 }