229 changed files with 158 additions and 13845 deletions
@ -1,7 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: 5b07afdbcf13e43438545d591cfd2e4b |
|
||||
DefaultImporter: |
|
||||
externalObjects: {} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -0,0 +1,27 @@ |
|||||
|
fileFormatVersion: 2 |
||||
|
guid: a94cf6fef2879da4c91e5ef768aadf4e |
||||
|
PluginImporter: |
||||
|
externalObjects: {} |
||||
|
serializedVersion: 2 |
||||
|
iconMap: {} |
||||
|
executionOrder: {} |
||||
|
defineConstraints: [] |
||||
|
isPreloaded: 0 |
||||
|
isOverridable: 0 |
||||
|
isExplicitlyReferenced: 0 |
||||
|
validateReferences: 1 |
||||
|
platformData: |
||||
|
- first: |
||||
|
Any: |
||||
|
second: |
||||
|
enabled: 1 |
||||
|
settings: {} |
||||
|
- first: |
||||
|
Editor: Editor |
||||
|
second: |
||||
|
enabled: 0 |
||||
|
settings: |
||||
|
DefaultValueInitialized: true |
||||
|
userData: |
||||
|
assetBundleName: |
||||
|
assetBundleVariant: |
||||
@ -1,180 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using UnityEngine; |
|
||||
|
|
||||
public class AcidRainCloud : Enemy |
|
||||
{ |
|
||||
|
|
||||
|
|
||||
|
|
||||
private void Start() |
|
||||
{ |
|
||||
enemyNode = GetComponent<EnemyNode>(); |
|
||||
actionPool.Add(EnemyPlanUIManager.Instance.NewAction(EnemyPlanUIFunction.shootAndPollute), 0.4f); |
|
||||
actionPool.Add(EnemyPlanUIManager.Instance.NewAction(EnemyPlanUIFunction.attack), 0.6f); |
|
||||
enemyNode.sufferAbnormalCondition(AbnormalCondition.acidRain, 1); |
|
||||
enemyNode.sufferAbnormalCondition(AbnormalCondition.vulnerable, 3); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
private void OnEnable() |
|
||||
{ |
|
||||
|
|
||||
|
|
||||
} |
|
||||
public override IEnumerator JudgeActionCoroutine()//等移动到位置就判断是否还能走
|
|
||||
{ |
|
||||
Debug.Log("真正行动是:" + enemyAction); |
|
||||
switch (enemyAction) |
|
||||
{ |
|
||||
case EnemyAction_ShootAndPollute: |
|
||||
yield return StartCoroutine(PolluteAction()); |
|
||||
break; |
|
||||
case EnemyActionAction_Attack: |
|
||||
yield return StartCoroutine(MeleeAttackAction()); |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
public override void BoolCheck() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyAction_ShootAndPollute: |
|
||||
canMove = false; |
|
||||
canAttack = false; |
|
||||
canAoe = false; |
|
||||
break; |
|
||||
case EnemyActionAction_Attack: |
|
||||
canMove = false; |
|
||||
canAttack = true; |
|
||||
canAoe=false; |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
public override void ActionValRandom() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyAction_ShootAndPollute: |
|
||||
enemyNode.currentActionScript.colA = MathTool.RandomTarget(5, 0.2f); |
|
||||
break; |
|
||||
case EnemyActionAction_Attack: |
|
||||
enemyNode.currentActionScript.colA = MathTool.RandomTarget(enemyNode.EnemyState.damage, 0.1f); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public override void SettlePlannText(EnemyAction currentAction) |
|
||||
{ |
|
||||
switch (currentAction) |
|
||||
{ |
|
||||
case EnemyAction_ShootAndPollute: |
|
||||
//改变文本
|
|
||||
enemyNode.currentActionScript.SettleText(enemyNode, enemyNode.DamageCalculation(enemyNode.currentActionScript.colA).ToString(), "对全场造成" + enemyNode.DamageCalculation(enemyNode.currentActionScript.colA).ToString() + "点伤害,随机污染6格地块"); |
|
||||
break; |
|
||||
case EnemyActionAction_Attack: |
|
||||
enemyNode.currentActionScript.SettleText(enemyNode, enemyNode.DamageCalculation(enemyNode.currentActionScript.colA).ToString(), "造成"+ enemyNode.DamageCalculation(enemyNode.currentActionScript.colA).ToString() + "点伤害,使玩家手牌中随机一张牌变为消耗"); |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
public override IEnumerator MeleeAttackAction() |
|
||||
{ |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
HashSet<MapUnity> targetSet=new HashSet<MapUnity> { GameManager.Instance.playerOn }; |
|
||||
getNodeTools.getCircleNodeForEnemy(targetSet, 1); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
yield return StartCoroutine(enemyNode.MeleeAttackAim()); |
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AttackDamage(enemyNode.currentActionScript.colA, 1); |
|
||||
Usermanager.Instance.SufferPlayerAbnormalCondition(AbnormalCondition.nextDrawCardisDisposable, 1); |
|
||||
//RandomTurnHandCardTempIsDisposable(1);
|
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
yield return StartCoroutine(moveTowardsPlayer()); |
|
||||
yield return new WaitForSeconds(1); |
|
||||
currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
yield return StartCoroutine(enemyNode.MeleeAttackAim()); |
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AttackDamage(enemyNode.currentActionScript.colA, 1); |
|
||||
Usermanager.Instance.SufferPlayerAbnormalCondition(AbnormalCondition.nextDrawCardisDisposable, 1); |
|
||||
//RandomTurnHandCardTempIsDisposable(1);
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void RandomTurnHandCardTempIsDisposable(int num) |
|
||||
{ |
|
||||
HashSet < CardEntity > targetSet= MathTool.GetRandomElements(new HashSet<CardEntity>(TurnMaster.Instance.handCard.cardEntityList), num); |
|
||||
foreach(CardEntity cardEntity in targetSet) |
|
||||
{ |
|
||||
cardEntity.tempIsDisposable = true; |
|
||||
} |
|
||||
} |
|
||||
public IEnumerator ThrowAttackAction(int count) |
|
||||
{ |
|
||||
int range = 2; |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (currentNode.whoColour == Name.NodeColor.Black) |
|
||||
{ |
|
||||
range = 3; |
|
||||
} |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
//yield return StartCoroutine(enemyNode.MeleeAttackAim());
|
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AoeDamage(getNodeTools.getNodesCount(Name.Color.Black), count, GameManager.Instance.playerOn, range); |
|
||||
} |
|
||||
yield return null; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public IEnumerator PolluteAction() |
|
||||
{ |
|
||||
AttackDamage(enemyNode.currentActionScript.colA, 1); |
|
||||
RandomPollute(getNodeTools.getAllNotBlackNodes(), 6); |
|
||||
yield return new WaitForSeconds(0.5f); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: 0d79ad6169a7e3249929c9b64a492eec |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,165 +0,0 @@ |
|||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using UnityEngine; |
|
||||
|
|
||||
public class BoundSoul : Enemy |
|
||||
{ |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
private void Start() |
|
||||
{ |
|
||||
enemyNode = GetComponent<EnemyNode>(); |
|
||||
enemyNode.sufferAbnormalCondition(AbnormalCondition.parasitism, 1); |
|
||||
enemyNode.sufferAbnormalCondition(AbnormalCondition.Buff_BoundSoul, 1); |
|
||||
actionPool.Add(EnemyPlanUIManager.Instance.NewAction(EnemyPlanUIFunction.attack), 1.0f); |
|
||||
|
|
||||
GameManager.Instance.PlayerMove += SettleRangeAttack; |
|
||||
} |
|
||||
|
|
||||
private void OnDestroy() |
|
||||
{ |
|
||||
if(GameManager.Instance!=null) |
|
||||
GameManager.Instance.PlayerMove -= SettleRangeAttack; |
|
||||
} |
|
||||
public override void SettleRangeAttack() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyActionAction_Attack: |
|
||||
enemyNode.enemyUIBar.outAttackRange.SetActive(!enemyNode.rangePool.Contains(GameManager.Instance.playerOn)); |
|
||||
break; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public override void BoolCheck() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyActionAction_Attack: |
|
||||
canMove = true; |
|
||||
canAttack = true; |
|
||||
canAoe = false; |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
public override void ActionValRandom() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyActionAction_Attack: |
|
||||
enemyNode.currentActionScript.colA = MathTool.RandomTarget(enemyNode.EnemyState.damage, 0.1f); |
|
||||
enemyNode.currentActionScript.colB = 2; |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void Update() |
|
||||
{ |
|
||||
if (enemyNode!=null&&enemyNode.currentActionScript != null) |
|
||||
{ |
|
||||
if (MapUnityManager.Instance.enemyNodeCount > 15) |
|
||||
{ |
|
||||
enemyNode.currentActionScript.colB=3; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
enemyNode.currentActionScript.colB =2; |
|
||||
} |
|
||||
enemyNode.enemy.SettlePlannText(enemyNode.enemy.enemyAction); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
public override void SettlePlannText(EnemyAction currentAction) |
|
||||
{ |
|
||||
switch (currentAction) |
|
||||
{ |
|
||||
case EnemyActionAction_Attack: |
|
||||
//改变文本
|
|
||||
string attackText = enemyNode.DamageCalculation(enemyNode.currentActionScript.colA).ToString(); |
|
||||
string stepRangeText = enemyNode.getStepRange().ToString(); |
|
||||
enemyNode.currentActionScript.SettleText(enemyNode,attackText+"*"+ enemyNode.currentActionScript.colB.ToString(), "造成"+attackText +"点伤害"+ enemyNode.currentActionScript.colB+"次并至多移动" +stepRangeText +"个格子"); |
|
||||
break; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
} |
|
||||
public override IEnumerator JudgeActionCoroutine()//等移动到位置就判断是否还能走
|
|
||||
{ |
|
||||
Debug.Log("真正行动是:" + enemyAction); |
|
||||
switch (enemyAction) |
|
||||
{ |
|
||||
case EnemyActionAction_Attack: |
|
||||
yield return StartCoroutine(MeleeAttackAction()); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public override IEnumerator MeleeAttackAction() |
|
||||
{ |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
int damageCount = 2; |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
yield return StartCoroutine(enemyNode.MeleeAttackAim()); |
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
if (MapUnityManager.Instance.enemyNodeCount>15) |
|
||||
{ |
|
||||
damageCount++; |
|
||||
} |
|
||||
AttackDamage(enemyNode.currentActionScript.colA, enemyNode.currentActionScript.colB); |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
yield return StartCoroutine(moveTowardsPlayer()); |
|
||||
yield return new WaitForSeconds(1); |
|
||||
currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
yield return StartCoroutine(enemyNode.MeleeAttackAim()); |
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
if (MapUnityManager.Instance.enemyNodeCount > 15) |
|
||||
{ |
|
||||
damageCount++; |
|
||||
} |
|
||||
AttackDamage(enemyNode.EnemyState.damage, damageCount); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: d259254ccfef91d4087ce9c39e136cd0 |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,186 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using UnityEngine; |
|
||||
using UnityEngine.UIElements; |
|
||||
|
|
||||
public class Climavista : Enemy |
|
||||
{ |
|
||||
|
|
||||
|
|
||||
|
|
||||
private void Start() |
|
||||
{ |
|
||||
actionPool.Add(EnemyPlanUIManager.Instance.NewAction(EnemyPlanUIFunction.shield), 0.7f); |
|
||||
actionPool.Add(EnemyPlanUIManager.Instance.NewAction(EnemyPlanUIFunction.summon), 0.3f); |
|
||||
enemyNode = GetComponent<EnemyNode>(); |
|
||||
enemyNode.sufferAbnormalCondition(AbnormalCondition.halfDamageInBlack, 1); |
|
||||
} |
|
||||
|
|
||||
private void OnEnable() |
|
||||
{ |
|
||||
|
|
||||
|
|
||||
} |
|
||||
public override IEnumerator JudgeActionCoroutine()//等移动到位置就判断是否还能走
|
|
||||
{ |
|
||||
Debug.Log("真正行动是:" + enemyAction); |
|
||||
switch (enemyAction) |
|
||||
{ |
|
||||
case EnemyActionAction_Shield: |
|
||||
yield return StartCoroutine(ShieldAction()); |
|
||||
break; |
|
||||
case EnemyAction_Summon: |
|
||||
yield return StartCoroutine(SummonAction()); |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public override void BoolCheck() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyActionAction_Shield: |
|
||||
canMove = false; |
|
||||
canAttack = false; |
|
||||
canAoe = false; |
|
||||
break; |
|
||||
case EnemyAction_Summon: |
|
||||
canMove = false; |
|
||||
canAttack = false; |
|
||||
canAoe = false; |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public override void ActionValRandom() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyActionAction_Shield: |
|
||||
enemyNode.currentActionScript.colA = MathTool.RandomTarget(15, 0.1f); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
public override void SettlePlannText(EnemyAction currentAction) |
|
||||
{ |
|
||||
switch (currentAction) |
|
||||
{ |
|
||||
case EnemyActionAction_Shield: |
|
||||
//改变文本
|
|
||||
enemyNode.currentActionScript.SettleText(enemyNode, enemyNode.currentActionScript.colA.ToString(), "对生命值最低的一个单位施加" + enemyNode.currentActionScript.colA.ToString() + "点护盾"); |
|
||||
break; |
|
||||
case EnemyAction_Summon: |
|
||||
enemyNode.currentActionScript.SettleText(enemyNode, "", "复制一个当前状态的酸雨云"); |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public override IEnumerator ShieldAction() |
|
||||
{ |
|
||||
int minHp = 100; |
|
||||
int index = 0; |
|
||||
for (int i = 0; i < EnemyManager.Instance.enemySpeedSortingList.Count; i++) |
|
||||
{ |
|
||||
if ((int)EnemyManager.Instance.enemySpeedSortingList[i].EnemyState.currentHP < minHp) |
|
||||
{ |
|
||||
minHp = (int)EnemyManager.Instance.enemySpeedSortingList[i].EnemyState.currentHP; |
|
||||
index = i; |
|
||||
} |
|
||||
} |
|
||||
EnemyManager.Instance.enemySpeedSortingList[index].EnemyState.shieldValue += EnemyManager.Instance.enemySpeedSortingList[index].ShieldCalculation(enemyNode.currentActionScript.colA); |
|
||||
yield return new WaitForSeconds(0.5f); |
|
||||
} |
|
||||
|
|
||||
public void RandomTurnHandCardTempIsDisposable(int num) |
|
||||
{ |
|
||||
HashSet < CardEntity > targetSet= MathTool.GetRandomElements(new HashSet<CardEntity>(TurnMaster.Instance.handCard.cardEntityList), num); |
|
||||
foreach(CardEntity cardEntity in targetSet) |
|
||||
{ |
|
||||
cardEntity.tempIsDisposable = true; |
|
||||
} |
|
||||
} |
|
||||
public IEnumerator SummonAction() |
|
||||
{ |
|
||||
GameObject target= null; |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
HashSet<MapUnity> set = new HashSet<MapUnity> { GameManager.Instance.playerOn }; |
|
||||
getNodeTools.getCircleNode(set, 1); |
|
||||
HashSet<MapUnity> targetSet = MathTool.GetRandomElements(set,1); |
|
||||
MapUnity enemyMapunity=targetSet.ElementAt(0); |
|
||||
EnemyNode targetEnemy=new EnemyNode(); |
|
||||
for (int i = 0; i < EnemyManager.Instance.enemySpeedSortingList.Count; i++) |
|
||||
{ |
|
||||
if (EnemyManager.Instance.enemySpeedSortingList[i].enemyScript==EnemyNode.EnemyScript.AcidRainCloud) |
|
||||
{ |
|
||||
target = EnemyManager.Instance.enemySpeedSortingList[i].GetComponent<GameObject>(); |
|
||||
targetEnemy=EnemyManager.Instance.enemySpeedSortingList[i]; |
|
||||
} |
|
||||
} |
|
||||
if (target == null||enemyMapunity==null) |
|
||||
{ |
|
||||
yield return null; |
|
||||
} |
|
||||
List<GameObject> enemyPrefabList = EnemyPool.getEnemyPrefab(new List<string> { Name.EnemyName.AcidRainCloud }); |
|
||||
HashSet<MapUnity> allCanUseNode = getNodeTools.getAllCanUseNode(); |
|
||||
if (enemyPrefabList.Count > 0) |
|
||||
{ |
|
||||
foreach (var enemyPrefab in enemyPrefabList) |
|
||||
{ |
|
||||
MapUnity currentMapUnity = allCanUseNode.ElementAt(UnityEngine.Random.Range(0, allCanUseNode.Count)); |
|
||||
var currentEnemy = Instantiate(enemyPrefab, currentMapUnity.transform.position, enemyPrefab.transform.rotation); |
|
||||
EnemyNode enemynode = currentEnemy.GetComponent<EnemyNode>(); |
|
||||
enemynode.positionX = currentMapUnity.locationX; |
|
||||
enemynode.positionY = currentMapUnity.locationY; |
|
||||
enemynode.StartPosition(); |
|
||||
enemynode.EnemyState.copy(targetEnemy.EnemyState); |
|
||||
//enemynode.EnemyState == targetEnemy.EnemyState;
|
|
||||
allCanUseNode.Remove(currentMapUnity); |
|
||||
yield return new WaitForSeconds(0.5f); |
|
||||
} |
|
||||
} |
|
||||
/*var currentenemy = Instantiate(target, this.transform.position, this.transform.rotation); |
|
||||
EnemyNode newEnemyNode = currentenemy.GetComponent<EnemyNode>(); |
|
||||
newEnemyNode.positionX = enemyMapunity.locationX; |
|
||||
newEnemyNode.positionY = enemyMapunity.locationY; |
|
||||
MapUnity newNode = getNodeTools.LocationToGetNode(newEnemyNode.positionX, newEnemyNode.positionY); |
|
||||
newNode.enemyNode = newEnemyNode;*/ |
|
||||
yield return new WaitForSeconds(0.5f); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public IEnumerator PolluteAction() |
|
||||
{ |
|
||||
AttackDamage(5,1); |
|
||||
RandomPollute(getNodeTools.getAllNotBlackNodes(), 6); |
|
||||
yield return new WaitForSeconds(0.5f); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: b46e9eb3a752a3e4eb4c052abe78f82a |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,137 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using UnityEngine; |
|
||||
|
|
||||
public class ContaminatusImmortalis : Enemy |
|
||||
{ |
|
||||
|
|
||||
private void Start() |
|
||||
{ |
|
||||
enemyNode = GetComponent<EnemyNode>(); |
|
||||
enemyNode.sufferAbnormalCondition(AbnormalCondition.Buff_ContaminatusImmortalis, 1); |
|
||||
actionPool.Add(EnemyPlanUIManager.Instance.NewAction(EnemyPlanUIFunction.attack), 0.7f); |
|
||||
actionPool.Add(EnemyPlanUIManager.Instance.NewAction(EnemyPlanUIFunction.shootAndPollute), 0.3f); |
|
||||
|
|
||||
GameManager.Instance.PlayerMove += SettleRangeAttack; |
|
||||
} |
|
||||
|
|
||||
private void OnDestroy() |
|
||||
{ |
|
||||
if (GameManager.Instance != null) |
|
||||
GameManager.Instance.PlayerMove -= SettleRangeAttack; |
|
||||
} |
|
||||
public override void SettleRangeAttack() |
|
||||
{ |
|
||||
enemyNode.enemyUIBar.outAttackRange.SetActive(!enemyNode.rangePool.Contains(GameManager.Instance.playerOn)); |
|
||||
} |
|
||||
|
|
||||
public override void ActionValRandom() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyActionAction_Attack: |
|
||||
enemyNode.currentActionScript.colA = MathTool.RandomTarget(enemyNode.EnemyState.damage, 0.1f); |
|
||||
break; |
|
||||
case EnemyAction_ShootAndPollute: |
|
||||
enemyNode.currentActionScript.colA = MathTool.RandomTarget(9, 0.1f); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
public override void SettlePlannText(EnemyAction currentAction) |
|
||||
{ |
|
||||
switch (currentAction) |
|
||||
{ |
|
||||
case EnemyActionAction_Attack: |
|
||||
string attackText = enemyNode.DamageCalculation(enemyNode.currentActionScript.colA).ToString(); |
|
||||
string stepRangeText = enemyNode.getStepRange().ToString(); |
|
||||
enemyNode.currentActionScript.SettleText(enemyNode, attackText+ "*4", "造成" + attackText + "*4点伤害"); |
|
||||
break; |
|
||||
case EnemyAction_ShootAndPollute: |
|
||||
enemyNode.currentActionScript.SettleText(enemyNode, enemyNode.currentActionScript.colA.ToString(), "对场地随机14格地面造成"+ enemyNode.currentActionScript.colA+"点伤害,污染地面"); |
|
||||
break; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public override IEnumerator JudgeActionCoroutine()//等移动到位置就判断是否还能走
|
|
||||
{ |
|
||||
Debug.Log("真正行动是:" + enemyAction); |
|
||||
switch (enemyAction) |
|
||||
{ |
|
||||
case EnemyActionAction_Attack: |
|
||||
yield return StartCoroutine(MeleeAttackAction(4)); |
|
||||
break; |
|
||||
case EnemyAction_ShootAndPollute: |
|
||||
yield return StartCoroutine(PolluteAction()); |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public override void BoolCheck() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyActionAction_Attack: |
|
||||
canMove = true; |
|
||||
canAttack = true; |
|
||||
canAoe = false; |
|
||||
break; |
|
||||
case EnemyAction_ShootAndPollute: |
|
||||
canMove = false; |
|
||||
canAttack = false; |
|
||||
canAoe = true; |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public override void GetAimTarget() |
|
||||
{ |
|
||||
if (targets != null) |
|
||||
{ |
|
||||
targets.Clear(); |
|
||||
} |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyAction_ShootAndPollute: |
|
||||
targets = MathTool.GetRandomElements(getNodeTools.getAllNotBlackNodes(), 14); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public IEnumerator PolluteAction() |
|
||||
{ |
|
||||
//HashSet<MapUnity> targets = MathTool.GetRandomElements(getNodeTools.getAllNotBlackNodes(), 14);
|
|
||||
PolluteAndDamageNodes(targets,Name.NodeColor.Black, enemyNode.currentActionScript.colA, 1); |
|
||||
yield return new WaitForSeconds(0.5f); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: d8dda45e065f05d4184f7dc5a89f69ec |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,559 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using Unity.VisualScripting; |
|
||||
using UnityEngine; |
|
||||
using static TurnMaster; |
|
||||
|
|
||||
public class Enemy : MonoBehaviour |
|
||||
{ |
|
||||
public EnemyNode enemyNode; |
|
||||
|
|
||||
public bool canMove=false; |
|
||||
|
|
||||
public bool canAttack=false; |
|
||||
|
|
||||
public bool canAoe = false; |
|
||||
|
|
||||
//怪物行动
|
|
||||
public EnemyAction enemyAction; |
|
||||
|
|
||||
//瞄准目标
|
|
||||
public MapUnity aimNode; |
|
||||
|
|
||||
public Dictionary<EnemyAction, float> actionPool = new Dictionary<EnemyAction, float>(); |
|
||||
|
|
||||
public ZeroToFiveCircularCounter counter = new ZeroToFiveCircularCounter(); |
|
||||
|
|
||||
public HashSet<MapUnity> targets = new HashSet<MapUnity>(); |
|
||||
[Header("瞄准射线图层剔除")] |
|
||||
public LayerMask layerMask; |
|
||||
|
|
||||
// [Header("计数标量")]
|
|
||||
// public float time;
|
|
||||
// float lastTime = 0;
|
|
||||
[Header("移动速度标量")] |
|
||||
float moveSpeed =5f; |
|
||||
|
|
||||
public void enemyTurn() |
|
||||
{ |
|
||||
|
|
||||
StartCoroutine(JudgNextActionCoroutine()); |
|
||||
|
|
||||
} |
|
||||
public virtual void ChooseAction() |
|
||||
{ |
|
||||
enemyAction = new EnemyAction_Nothing(); |
|
||||
Debug.Log("actionPool大小" + actionPool.Count()+this .name ); |
|
||||
if (enemyNode == null) |
|
||||
{ |
|
||||
Debug.Log("enemyNode大小"); |
|
||||
} |
|
||||
enemyAction = enemyNode.GetRandomAction(actionPool); |
|
||||
Debug.Log("行动是:" + enemyAction); |
|
||||
enemyNode.enemyUIBar.SwitchIntention(enemyAction); |
|
||||
ActionValRandom(); |
|
||||
BoolCheck(); |
|
||||
GetAimTarget(); |
|
||||
enemyNode.enemy.SettlePlannText(enemyNode.enemy.enemyAction); |
|
||||
enemyNode.enemy.SettleRangeAttack(); |
|
||||
} |
|
||||
|
|
||||
public void Update() |
|
||||
{ |
|
||||
if (enemyNode != null && enemyNode.currentActionScript != null) |
|
||||
{ |
|
||||
enemyNode.enemy.SettlePlannText(enemyNode.enemy.enemyAction); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public virtual void ActionValRandom() |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public virtual void BoolCheck() |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public virtual void GetAimTarget() |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
public virtual void SettlePlannText(EnemyAction currentAction) |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
public virtual void SettleRangeAttack() |
|
||||
{ |
|
||||
enemyNode.enemyUIBar.outAttackRange.SetActive(false); |
|
||||
} |
|
||||
public virtual void ChooseAimNode() |
|
||||
{ |
|
||||
aimNode = GameManager.Instance.playerOn; |
|
||||
} |
|
||||
|
|
||||
public void AttackDamage(int damage,int count) |
|
||||
{ |
|
||||
for (int i = 0; i < count; i++) |
|
||||
{ |
|
||||
Usermanager.Instance.SufferDamage(enemyNode.DamageCalculation(damage), enemyNode); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public int stealForgingPoint(int num) |
|
||||
{ |
|
||||
int result = 0; |
|
||||
int playCount = GameManager.Instance.playerState.forgingPoint; |
|
||||
if (playCount>=num) |
|
||||
{ |
|
||||
result = num; |
|
||||
GameManager.Instance.playerState.forgingPoint -= num; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
result = playCount; |
|
||||
GameManager.Instance.playerState.forgingPoint = 0; |
|
||||
} |
|
||||
PlayerStatsManager.Instance.BroadCastSyncText();//同步UI
|
|
||||
return result; |
|
||||
} |
|
||||
|
|
||||
public int stealMoney(int num) |
|
||||
{ |
|
||||
int result = 0; |
|
||||
int playCount = GameManager.Instance.playerState.money; |
|
||||
if (playCount >= num) |
|
||||
{ |
|
||||
result = num; |
|
||||
GameManager.Instance.playerState.money -= num; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
result = playCount; |
|
||||
GameManager.Instance.playerState.money = 0; |
|
||||
} |
|
||||
PlayerStatsManager.Instance.BroadCastSyncText();//同步UI
|
|
||||
return result; |
|
||||
} |
|
||||
|
|
||||
public void PolluteNodes(HashSet<MapUnity> targetSet,int color) |
|
||||
{ |
|
||||
foreach (MapUnity target in targetSet) |
|
||||
{ |
|
||||
target.switchColorForEnemy(color); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public void PolluteAndDamageNodes(HashSet<MapUnity> targetSet, int color,int damage,int damageCount) |
|
||||
{ |
|
||||
foreach (MapUnity target in targetSet) |
|
||||
{ |
|
||||
target.switchColorForEnemy(color); |
|
||||
if (GameManager.Instance.playerOn.Equals(target)) |
|
||||
{ |
|
||||
AttackDamage(damage, damageCount); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public void AoeDamage(int damage, int count,MapUnity targetNode,int range) |
|
||||
{ |
|
||||
HashSet<MapUnity> targetSet = new HashSet<MapUnity>(); |
|
||||
targetSet.Add(targetNode); |
|
||||
getNodeTools.getCircleNodeForBoom(targetSet, range); |
|
||||
if (targetSet.Contains(GameManager.Instance.playerOn)) |
|
||||
{ |
|
||||
for (int i = 0; i < count; i++) |
|
||||
{ |
|
||||
Usermanager.Instance.SufferDamage(enemyNode.DamageCalculation(damage), enemyNode); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
} |
|
||||
|
|
||||
public virtual IEnumerator MeleeAttackAction() |
|
||||
{ |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
yield return StartCoroutine(enemyNode.MeleeAttackAim()); |
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AttackDamage(enemyNode.currentActionScript.colA, 1); |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
yield return StartCoroutine(moveTowardsPlayer()); |
|
||||
yield return new WaitForSeconds(1); |
|
||||
currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
yield return StartCoroutine(enemyNode.MeleeAttackAim()); |
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AttackDamage(enemyNode.currentActionScript.colA, 1); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public virtual IEnumerator MeleeAttackAction(int damageCount) |
|
||||
{ |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
yield return StartCoroutine(enemyNode.MeleeAttackAim()); |
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AttackDamage(enemyNode.currentActionScript.colA, damageCount); |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
yield return StartCoroutine(moveTowardsPlayer()); |
|
||||
yield return new WaitForSeconds(1); |
|
||||
currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
yield return StartCoroutine(enemyNode.MeleeAttackAim()); |
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AttackDamage(enemyNode.currentActionScript.colA, damageCount); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public virtual IEnumerator ThrowAttackAction(int range,int damage,int count,MapUnity target) |
|
||||
{ |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
//yield return StartCoroutine(enemyNode.MeleeAttackAim());
|
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AoeDamage(damage, count, target, range); |
|
||||
} |
|
||||
yield return null; |
|
||||
} |
|
||||
public IEnumerator moveTowardsPlayer() |
|
||||
{ |
|
||||
enemyNode.FindPathTowardsPlayer(); |
|
||||
for (int i = 1; i < getMoveStep(); i++) |
|
||||
{ |
|
||||
if (enemyNode.pasth.Count > 1) |
|
||||
{ |
|
||||
//声音
|
|
||||
// AudioManager.Instance.EnemyMoveVoicePlayer();
|
|
||||
yield return StartCoroutine(moveOneStep(enemyNode.pasth[i])); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public IEnumerator moveAwayFromPlayer() |
|
||||
{ |
|
||||
enemyNode.FindPathAwayFromPlayer(); |
|
||||
for (int i = 1; i < getMoveStep(); i++) |
|
||||
{ |
|
||||
if (enemyNode.pasth.Count > 1) |
|
||||
{ |
|
||||
//声音
|
|
||||
// AudioManager.Instance.EnemyMoveVoicePlayer();
|
|
||||
yield return StartCoroutine(moveOneStep(enemyNode.pasth[i])); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public int getMoveStep() |
|
||||
{ |
|
||||
if (enemyNode.getStepRange() + 1 <= enemyNode.pasth.Count) |
|
||||
{ |
|
||||
return enemyNode.getStepRange() + 1; |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
return enemyNode.pasth.Count; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public IEnumerator moveOneStep(MapUnity nexMapUnity) |
|
||||
{ |
|
||||
//enemyNode.bleedCal();
|
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
MapUnity disNode = nexMapUnity; |
|
||||
currentNode.blocked = false; |
|
||||
currentNode.enemyNode = null; |
|
||||
enemyNode.positionX = disNode.locationX; |
|
||||
enemyNode.positionY = disNode.locationY; |
|
||||
disNode.enemyNode = enemyNode; |
|
||||
// transform.SetParent(disNode.CylinderFloor.transform);
|
|
||||
|
|
||||
yield return StartCoroutine(MoveCoroutine(disNode)); |
|
||||
} |
|
||||
|
|
||||
public IEnumerator MoveCoroutine(MapUnity endMapUnity)//移动到位置
|
|
||||
{ |
|
||||
Vector3 startPos = transform.position; |
|
||||
Vector3 endpos = new Vector3(endMapUnity.transform.position.x, transform.position.y, endMapUnity.transform.position.z); |
|
||||
//直线运动
|
|
||||
/*float time = 0; |
|
||||
bool move = true; |
|
||||
while (move) |
|
||||
{ |
|
||||
transform.position = Vector3.Lerp(startPos, endpos, time += Time.deltaTime * moveSpeed); |
|
||||
|
|
||||
if (time >= 1) |
|
||||
{ |
|
||||
move = false; |
|
||||
} |
|
||||
yield return null; |
|
||||
}*/ |
|
||||
//曲线跳跃
|
|
||||
Vector3 jumpCentre = new Vector3((startPos.x + endpos.x) / 2.0f, (startPos.y + endpos.y) / 2.0f + enemyNode.jumpHeight, (startPos.z + endpos.z) / 2.0f); |
|
||||
List<Vector3> linePath = new List<Vector3>(); |
|
||||
linePath = enemyNode.CalculatePath(linePath, enemyNode.posCount, startPos, jumpCentre, endpos); |
|
||||
bool move = true; |
|
||||
float time = 0; |
|
||||
Debug.Log("开始" + startPos + "结束" + endpos + "中间" + jumpCentre); |
|
||||
|
|
||||
for (int posIndex = 0; posIndex < linePath.Count; posIndex++) |
|
||||
{ |
|
||||
time = 0; |
|
||||
move = true; |
|
||||
while (move) |
|
||||
{ |
|
||||
if (posIndex == linePath.Count - 1) |
|
||||
{ |
|
||||
transform.position = Vector3.Lerp(linePath[posIndex], endpos, time += Time.deltaTime * enemyNode.speedCurve.Evaluate(posIndex / enemyNode.posCount) * enemyNode.jumpSpeed); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
transform.position = Vector3.Lerp(linePath[posIndex], linePath[posIndex + 1], time += Time.deltaTime * enemyNode.speedCurve.Evaluate(posIndex / enemyNode.posCount) * enemyNode.jumpSpeed); //time += Time.deltaTime * speedCurve.Evaluate(posIndex+1 /posCount ));
|
|
||||
} |
|
||||
|
|
||||
if (time >= 1) |
|
||||
{ |
|
||||
move = false; |
|
||||
} |
|
||||
yield return null; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
// transform.localPosition = new Vector3(0, 0, -0.1468f);
|
|
||||
//声音
|
|
||||
AudioManager.Instance.EnemyMoveVoicePlayer(); |
|
||||
//判断腐蚀
|
|
||||
enemyNode.CorrodeRealize(endMapUnity); |
|
||||
//判断流血
|
|
||||
enemyNode.bleedRealize(); |
|
||||
yield break; |
|
||||
} |
|
||||
|
|
||||
public IEnumerator MeleeAttackAndPolluteAction() |
|
||||
{ |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
yield return StartCoroutine(enemyNode.MeleeAttackAim()); |
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AttackDamage(enemyNode.EnemyState.damage, 1); |
|
||||
GameManager.Instance.playerOn.switchColorForEnemy(Name.NodeColor.Black); |
|
||||
int offset = getNodeTools.getEnemyToPlayerUnitPoolOffset(GameManager.Instance.playerOn, currentNode); |
|
||||
if (GameManager.Instance.playerOn.unitPool[counter.Add(2, offset)] != null) |
|
||||
{ |
|
||||
MapUnity mapUnityA = GameManager.Instance.playerOn.unitPool[counter.Add(2, offset)]; |
|
||||
mapUnityA.switchColorForEnemy(Name.NodeColor.Black); |
|
||||
} |
|
||||
if (GameManager.Instance.playerOn.unitPool[counter.Add(3, offset)] != null) |
|
||||
{ |
|
||||
MapUnity mapUnityA = GameManager.Instance.playerOn.unitPool[counter.Add(3, offset)]; |
|
||||
mapUnityA.switchColorForEnemy(Name.NodeColor.Black); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
yield return StartCoroutine(moveTowardsPlayer()); |
|
||||
yield return new WaitForSeconds(1); |
|
||||
currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
yield return StartCoroutine(enemyNode.MeleeAttackAim()); |
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AttackDamage(enemyNode.EnemyState.damage, 1); |
|
||||
GameManager.Instance.playerOn.switchColorForEnemy(Name.NodeColor.Black); |
|
||||
int offset = getNodeTools.getEnemyToPlayerUnitPoolOffset(GameManager.Instance.playerOn, currentNode); |
|
||||
if (GameManager.Instance.playerOn.unitPool[counter.Add(2, offset)] != null) |
|
||||
{ |
|
||||
MapUnity mapUnityA = GameManager.Instance.playerOn.unitPool[counter.Add(2, offset)]; |
|
||||
mapUnityA.switchColorForEnemy(Name.NodeColor.Black); |
|
||||
} |
|
||||
if (GameManager.Instance.playerOn.unitPool[counter.Add(3, offset)] != null) |
|
||||
{ |
|
||||
MapUnity mapUnityA = GameManager.Instance.playerOn.unitPool[counter.Add(3, offset)]; |
|
||||
mapUnityA.switchColorForEnemy(Name.NodeColor.Black); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void RandomPollute(HashSet<MapUnity> set, int num) |
|
||||
{ |
|
||||
HashSet<MapUnity> randomNodes = MathTool.GetRandomElements(set, num); |
|
||||
foreach (var node in randomNodes) |
|
||||
{ |
|
||||
node.switchColorForEnemy(Name.NodeColor.Black); |
|
||||
} |
|
||||
GameManager.Instance.SyncColourCountUI(); |
|
||||
} |
|
||||
|
|
||||
public void ClearNodes(HashSet<MapUnity> set) |
|
||||
{ |
|
||||
foreach (MapUnity node in set) |
|
||||
{ |
|
||||
if (Name.NodeColor.PlayerColor.Contains(node.whoColour)) |
|
||||
{ |
|
||||
node.switchColorForEnemy(Name.NodeColor.White); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
GameManager.Instance.SyncColourCountUI(); |
|
||||
} |
|
||||
|
|
||||
public int ClearNodesReturnCount(HashSet<MapUnity> set) |
|
||||
{ |
|
||||
int result = 0; |
|
||||
foreach (MapUnity node in set) |
|
||||
{ |
|
||||
if(node.whoColour!= Name.NodeColor.White) |
|
||||
{ |
|
||||
node.switchColorForEnemy(Name.NodeColor.White); |
|
||||
result++; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
GameManager.Instance.SyncColourCountUI(); |
|
||||
return result; |
|
||||
} |
|
||||
|
|
||||
public virtual void OnDeath() |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
public void RecoverHp(int val) |
|
||||
{ |
|
||||
float recoverHp = val + enemyNode.EnemyState.currentHP; |
|
||||
float trueHp = Math.Min(recoverHp, enemyNode.EnemyState.maxHP); |
|
||||
enemyNode.EnemyState.currentHP = trueHp; |
|
||||
} |
|
||||
|
|
||||
public virtual void enemyTurnEnd() |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public virtual void enemyTurnBegin() |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
public virtual IEnumerator ShieldAction() |
|
||||
{ |
|
||||
enemyNode.EnemyState.shieldValue += 4; |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
enemyNode.anim.SetTrigger("Action"); |
|
||||
yield return new WaitForSeconds(0.5f); |
|
||||
AttackDamage(enemyNode.EnemyState.damage,1); |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
yield return StartCoroutine(moveTowardsPlayer()); |
|
||||
yield return new WaitForSeconds(1); |
|
||||
currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
enemyNode.anim.SetTrigger("Action"); |
|
||||
yield return new WaitForSeconds(0.5f); |
|
||||
AttackDamage(enemyNode.EnemyState.damage, 1); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public virtual IEnumerator JudgNextActionCoroutine() |
|
||||
{ |
|
||||
if (enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.coma)) |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
yield return StartCoroutine(JudgeActionCoroutine()); |
|
||||
} |
|
||||
//下回合意图
|
|
||||
ArcherAim(); |
|
||||
|
|
||||
//让下一个敌人运动
|
|
||||
EnemyManager.Instance.enemyTurnState = EnemyManager.EnemyTurnState.runing; |
|
||||
} |
|
||||
|
|
||||
public void ArcherAim() |
|
||||
{ |
|
||||
Vector3 dir = GameManager.Instance.player.transform.position - this.transform.position; |
|
||||
Ray ray = new Ray(this.transform.position, dir); |
|
||||
if (Physics.Raycast(ray, out RaycastHit raycastHit, 500, layerMask.value)) |
|
||||
{ |
|
||||
enemyNode.lineAim.GetComponent<EnemyAimLine>().aimGamgObject = raycastHit.collider.gameObject; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public virtual IEnumerator JudgeActionCoroutine()//等移动到位置就判断是否还能走
|
|
||||
{ |
|
||||
Debug.Log("真正行动是:" + enemyAction); |
|
||||
switch (enemyAction) |
|
||||
{ |
|
||||
case EnemyActionAction_Attack: |
|
||||
yield return StartCoroutine(MeleeAttackAction()); |
|
||||
break; |
|
||||
case EnemyAction_AttackAndShield: |
|
||||
yield return StartCoroutine(ShieldAction()); |
|
||||
break; |
|
||||
case EnemyAction_ShootAndPollute: |
|
||||
yield return StartCoroutine(MeleeAttackAndPolluteAction()); |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: ba002dfb2b8a52045816a7b9c1740657 |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,640 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using UnityEngine; |
|
||||
using UnityEngine.UI; |
|
||||
|
|
||||
public class EnemyManager : Singleton<EnemyManager> |
|
||||
{ |
|
||||
[SerializeField] |
|
||||
public List<IEnemyObserver> enemyObservers = new List<IEnemyObserver>(); |
|
||||
|
|
||||
[Header("悬停角色属性")]//uibar
|
|
||||
public GameObject statePanel; |
|
||||
public Text hPText; |
|
||||
public Text attackText; |
|
||||
public Text stepRangeText; |
|
||||
public Text attackRangeText; |
|
||||
public Text speedText; |
|
||||
public Text nameText; |
|
||||
public Image enemyIcon; |
|
||||
|
|
||||
// [Header("悬停角色意图")]//planAction
|
|
||||
// public GameObject planPanle;
|
|
||||
// public Text stateText;
|
|
||||
|
|
||||
[Header("怪物顺序控件")] |
|
||||
public List<EnemyNode> enemySpeedSortingList;//安照速度进行排序
|
|
||||
public int enemyCount;//记录几只怪进行了行动
|
|
||||
public EnemyTurnState enemyTurnState; |
|
||||
|
|
||||
[Header("怪物顺序UI控件")] |
|
||||
public List<GameObject> enemySortIconList = new List<GameObject>();//怪物排序UI图标
|
|
||||
public GameObject enemySortIconPrefab;//icon预制体
|
|
||||
public GameObject enemySortIconPanle;//排序父级面板
|
|
||||
|
|
||||
[Header("怪物局内UI条")] |
|
||||
public GameObject enemyUIBar; |
|
||||
public GameObject blockUIBar; |
|
||||
public enum EnemyTurnState |
|
||||
{ |
|
||||
stop, |
|
||||
runing, |
|
||||
end |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public void SpeedSortList() |
|
||||
{ |
|
||||
enemySpeedSortingList.Clear(); |
|
||||
foreach (var observer in enemyObservers) |
|
||||
{ |
|
||||
EnemyNode enemyNode = observer.GetEnemyNode(); |
|
||||
if(enemyNode .enemyType ==EnemyNode.EnemyType.enemy ) |
|
||||
{ |
|
||||
enemySpeedSortingList.Add(enemyNode); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
enemySpeedSortingList.Sort(SpeedSort); |
|
||||
} |
|
||||
private int SpeedSort(EnemyNode a, EnemyNode b) |
|
||||
{ |
|
||||
if (a.EnemyState.speed > b.EnemyState.speed) |
|
||||
return -1; |
|
||||
else |
|
||||
return 1; |
|
||||
} |
|
||||
|
|
||||
public bool isEnemyAlive(string enemyName) |
|
||||
{ |
|
||||
bool isAlive = false; |
|
||||
for (int i = 0; i < EnemyManager.Instance.enemySpeedSortingList.Count; i++) |
|
||||
{ |
|
||||
if (EnemyManager.Instance.enemySpeedSortingList[i].enemyScript==EnemyNode.EnemyScript.SoulMaker) |
|
||||
{ |
|
||||
isAlive=true; |
|
||||
return isAlive; |
|
||||
} |
|
||||
} |
|
||||
return isAlive; |
|
||||
} |
|
||||
public void GetEnemyPosition_Observer() |
|
||||
{ |
|
||||
foreach (var observer in enemyObservers ) |
|
||||
{ |
|
||||
observer.GetEnemyPosition(); |
|
||||
} |
|
||||
} |
|
||||
public void EnemyColour_Observer() |
|
||||
{ |
|
||||
foreach (var observer in enemyObservers) |
|
||||
{ |
|
||||
observer.EnemyColour(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void ShowExpHp_Observer(HashSet<MapUnity> mapUnities) |
|
||||
{ |
|
||||
foreach (var observer in enemyObservers) |
|
||||
{ |
|
||||
observer.ShowExpHp(mapUnities); |
|
||||
} |
|
||||
} |
|
||||
public void HideExpHP_Observer() |
|
||||
{ |
|
||||
foreach (var observer in enemyObservers) |
|
||||
{ |
|
||||
observer.HideExpHP(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void EnemyTurn_Observer() |
|
||||
{ |
|
||||
//SpeedSortList();
|
|
||||
enemyCount = 0; |
|
||||
enemyTurnState = EnemyTurnState.stop; |
|
||||
EnemySortIconDelete(); |
|
||||
EnemySortIconGnerate(); |
|
||||
StartCoroutine(EnemyTurn()); |
|
||||
} |
|
||||
|
|
||||
IEnumerator EnemyTurn() |
|
||||
{ |
|
||||
List<EnemyNode> enemySpeedSortingListCopy = new List<EnemyNode>(enemySpeedSortingList); |
|
||||
foreach (var observer in enemySpeedSortingListCopy) |
|
||||
{ |
|
||||
EnemySortIconSync(); |
|
||||
enemyTurnState = EnemyTurnState.stop; |
|
||||
observer.EnemyTurn(); |
|
||||
|
|
||||
|
|
||||
enemyCount += 1; |
|
||||
|
|
||||
yield return new WaitUntil(()=>enemyTurnState==EnemyTurnState.runing); |
|
||||
PlayerStatsManager.Instance.EffectFunction(6, "下一个"); |
|
||||
yield return new WaitForSeconds(1f); |
|
||||
Debug.Log("enemyCount是"+enemyCount); |
|
||||
if (enemyCount >= enemySpeedSortingListCopy.Count) |
|
||||
{ |
|
||||
TurnMaster.Instance.EndEnemyTurn(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
public void EnemySortIconGnerate() |
|
||||
{ |
|
||||
// enemySortIconPanle.GetComponent<RectTransform>().sizeDelta = new Vector2(enemySpeedSortingList.Count * 100 + 50, 100);
|
|
||||
|
|
||||
for (int i = 0; i < enemySpeedSortingList.Count; i++) |
|
||||
{ |
|
||||
var enemySortIcon = Instantiate(enemySortIconPrefab, enemySortIconPanle.transform ); |
|
||||
enemySortIcon.GetComponent<Image>().sprite = enemySpeedSortingList[i].EnemyState.enemyIcon; |
|
||||
|
|
||||
enemySortIconList.Add(enemySortIcon); |
|
||||
} |
|
||||
} |
|
||||
public void EnemySortIconSync() |
|
||||
{ |
|
||||
if (enemyCount >= 1) |
|
||||
{ |
|
||||
enemySortIconList[enemyCount-1].transform.localScale = new Vector3(1f, 1f, 1f); |
|
||||
enemySortIconList[enemyCount-1].transform.GetChild(0).gameObject.SetActive(false); |
|
||||
} |
|
||||
|
|
||||
enemySortIconList[enemyCount].transform.localScale = new Vector3(1.2f, 1.2f, 1.2f); |
|
||||
enemySortIconList[enemyCount].transform.GetChild(0).gameObject.SetActive(true); |
|
||||
} |
|
||||
public void EnemySortIconDelete() |
|
||||
{ |
|
||||
|
|
||||
for (int i = 0; i < enemySortIconList.Count; i++) |
|
||||
{ |
|
||||
Destroy(enemySortIconList[i]); |
|
||||
} |
|
||||
enemySortIconList.Clear(); |
|
||||
} |
|
||||
|
|
||||
public void EnemyAtionRandom() |
|
||||
{ |
|
||||
foreach (var observer in enemySpeedSortingList) |
|
||||
{ |
|
||||
observer.DetermineIntent(); |
|
||||
} |
|
||||
} |
|
||||
public void EnemySkillCoolDown_Observer() |
|
||||
{ |
|
||||
foreach (var observer in enemyObservers) |
|
||||
{ |
|
||||
observer.SettlementSkill(); |
|
||||
} |
|
||||
} |
|
||||
public void EnemyLine_Observer() |
|
||||
{ |
|
||||
foreach (var observer in enemyObservers) |
|
||||
{ |
|
||||
if(observer .GetEnemyNode ().enemyType ==EnemyNode.EnemyType.enemy ) |
|
||||
observer.AppearAimLine(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void enemyRefreshEnemyBuffIcon(int settleTurn) |
|
||||
{ |
|
||||
foreach (var observer in enemyObservers) |
|
||||
{ |
|
||||
//observer.GetEnemyNode().enemyTurnSettleInit();
|
|
||||
observer.GetEnemyNode().enemyRefreshUIIcon(settleTurn); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void enemyTurnSettle(int settleTurn) |
|
||||
{ |
|
||||
foreach (var observer in enemyObservers) |
|
||||
{ |
|
||||
//observer.GetEnemyNode().enemyTurnSettleInit();
|
|
||||
observer.GetEnemyNode().enemyTurnSettle(settleTurn); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void enemyShieldSettle(int settleTurn) |
|
||||
{ |
|
||||
foreach (var observer in enemyObservers) |
|
||||
{ |
|
||||
observer.GetEnemyNode().enemyShieldSettle(settleTurn); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void enemyTurnBeginSettle(int settleTurn) |
|
||||
{ |
|
||||
SpeedSortList(); |
|
||||
foreach (var observer in enemyObservers) |
|
||||
{ |
|
||||
//observer.GetEnemyNode().enemyTurnSettleInit();
|
|
||||
observer.GetEnemyNode().enemyTurnBeginSettle(settleTurn); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void enemyMultiplierRestore() |
|
||||
{ |
|
||||
foreach (var observer in enemyObservers) |
|
||||
{ |
|
||||
observer.GetEnemyNode().enemyTurnSettleInit(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void AttackRangeInfluencedNode(MapUnity enemyNode, int step, List<MapUnity> influencePreviewPool)//计算攻击范围
|
|
||||
{ |
|
||||
influencePreviewPool.Clear(); |
|
||||
|
|
||||
//GameManager.Instance.playerOn.InfluencePool = GameManager.Instance.playerOn.unitPool;
|
|
||||
MapUnity playerNode = enemyNode; |
|
||||
MapUnity currentNode = enemyNode; |
|
||||
MapUnity xRememberNode = enemyNode; |
|
||||
//Vector2 currentPoint = new Vector2(currentNode.locationX, currentNode.locationY);
|
|
||||
//Vector2 surchPoint = new Vector2(currentNode.locationX, currentNode.locationY-step);
|
|
||||
|
|
||||
//迭代六次-逆时针
|
|
||||
//向左
|
|
||||
for (int j = 0; j < step; j++) |
|
||||
{ |
|
||||
// surchPoint.y = currentNode.locationY+j+1;
|
|
||||
// surchPoint.x = currentNode.locationX;
|
|
||||
if (j != 0) |
|
||||
{ |
|
||||
if (xRememberNode.unitPool[0] != null) |
|
||||
{ |
|
||||
xRememberNode = xRememberNode.unitPool[0];//延迟一步
|
|
||||
} |
|
||||
else break; |
|
||||
} |
|
||||
|
|
||||
currentNode = xRememberNode; |
|
||||
|
|
||||
for (int k = 0; k < step - j; k++) |
|
||||
{ |
|
||||
if (currentNode.unitPool[5] != null) |
|
||||
{ |
|
||||
influencePreviewPool.Add(currentNode.unitPool[5]); |
|
||||
currentNode = currentNode.unitPool[5]; |
|
||||
} |
|
||||
else break; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
//向左下
|
|
||||
xRememberNode = playerNode;//记忆标量归位
|
|
||||
for (int j = 0; j < step; j++) |
|
||||
{ |
|
||||
// surchPoint.y = currentNode.locationY+j+1;
|
|
||||
// surchPoint.x = currentNode.locationX;
|
|
||||
if (j != 0) |
|
||||
{ |
|
||||
if (xRememberNode.unitPool[5] != null) |
|
||||
{ |
|
||||
xRememberNode = xRememberNode.unitPool[5];//延迟一步
|
|
||||
} |
|
||||
else break; |
|
||||
} |
|
||||
|
|
||||
currentNode = xRememberNode; |
|
||||
|
|
||||
for (int k = 0; k < step - j; k++) |
|
||||
{ |
|
||||
if (currentNode.unitPool[4] != null) |
|
||||
{ |
|
||||
influencePreviewPool.Add(currentNode.unitPool[4]); |
|
||||
currentNode = currentNode.unitPool[4]; |
|
||||
} |
|
||||
else break; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
//向右
|
|
||||
xRememberNode = playerNode;//记忆标量归位
|
|
||||
for (int j = 0; j < step; j++) |
|
||||
{ |
|
||||
// surchPoint.y = currentNode.locationY+j+1;
|
|
||||
// surchPoint.x = currentNode.locationX;
|
|
||||
if (j != 0) |
|
||||
{ |
|
||||
if (xRememberNode.unitPool[4] != null) |
|
||||
{ |
|
||||
xRememberNode = xRememberNode.unitPool[4];//延迟一步
|
|
||||
} |
|
||||
else break; |
|
||||
} |
|
||||
|
|
||||
currentNode = xRememberNode; |
|
||||
|
|
||||
for (int k = 0; k < step - j; k++) |
|
||||
{ |
|
||||
if (currentNode.unitPool[3] != null) |
|
||||
{ |
|
||||
influencePreviewPool.Add(currentNode.unitPool[3]); |
|
||||
currentNode = currentNode.unitPool[3]; |
|
||||
} |
|
||||
else break; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
//向右上
|
|
||||
xRememberNode = playerNode;//记忆标量归位
|
|
||||
for (int j = 0; j < step; j++) |
|
||||
{ |
|
||||
// surchPoint.y = currentNode.locationY+j+1;
|
|
||||
// surchPoint.x = currentNode.locationX;
|
|
||||
if (j != 0) |
|
||||
{ |
|
||||
if (xRememberNode.unitPool[3] != null) |
|
||||
{ |
|
||||
xRememberNode = xRememberNode.unitPool[3];//延迟一步
|
|
||||
} |
|
||||
else break; |
|
||||
} |
|
||||
|
|
||||
currentNode = xRememberNode; |
|
||||
|
|
||||
for (int k = 0; k < step - j; k++) |
|
||||
{ |
|
||||
if (currentNode.unitPool[2] != null) |
|
||||
{ |
|
||||
influencePreviewPool.Add(currentNode.unitPool[2]); |
|
||||
currentNode = currentNode.unitPool[2]; |
|
||||
} |
|
||||
else break; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
//向上
|
|
||||
xRememberNode = playerNode;//记忆标量归位
|
|
||||
for (int j = 0; j < step; j++) |
|
||||
{ |
|
||||
// surchPoint.y = currentNode.locationY+j+1;
|
|
||||
// surchPoint.x = currentNode.locationX;
|
|
||||
if (j != 0) |
|
||||
{ |
|
||||
if (xRememberNode.unitPool[2] != null) |
|
||||
{ |
|
||||
xRememberNode = xRememberNode.unitPool[2];//延迟一步
|
|
||||
} |
|
||||
else break; |
|
||||
} |
|
||||
|
|
||||
currentNode = xRememberNode; |
|
||||
|
|
||||
for (int k = 0; k < step - j; k++) |
|
||||
{ |
|
||||
if (currentNode.unitPool[1] != null) |
|
||||
{ |
|
||||
influencePreviewPool.Add(currentNode.unitPool[1]); |
|
||||
currentNode = currentNode.unitPool[1]; |
|
||||
} |
|
||||
else break; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
//向左上
|
|
||||
xRememberNode = playerNode;//记忆标量归位
|
|
||||
for (int j = 0; j < step; j++) |
|
||||
{ |
|
||||
// surchPoint.y = currentNode.locationY+j+1;
|
|
||||
// surchPoint.x = currentNode.locationX;
|
|
||||
if (j != 0) |
|
||||
{ |
|
||||
if (xRememberNode.unitPool[1] != null) |
|
||||
{ |
|
||||
xRememberNode = xRememberNode.unitPool[1];//延迟一步
|
|
||||
} |
|
||||
else break; |
|
||||
} |
|
||||
|
|
||||
currentNode = xRememberNode; |
|
||||
|
|
||||
for (int k = 0; k < step - j; k++) |
|
||||
{ |
|
||||
if (currentNode.unitPool[0] != null) |
|
||||
{ |
|
||||
influencePreviewPool.Add(currentNode.unitPool[0]); |
|
||||
currentNode = currentNode.unitPool[0]; |
|
||||
} |
|
||||
else break; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
//迭代六次-顺时针
|
|
||||
//向左
|
|
||||
xRememberNode = playerNode;//记忆标量归位
|
|
||||
for (int j = 0; j < step; j++) |
|
||||
{ |
|
||||
// surchPoint.y = currentNode.locationY+j+1;
|
|
||||
// surchPoint.x = currentNode.locationX;
|
|
||||
if (j != 0) |
|
||||
{ |
|
||||
if (xRememberNode.unitPool[5] != null) |
|
||||
{ |
|
||||
xRememberNode = xRememberNode.unitPool[5];//延迟一步
|
|
||||
} |
|
||||
else break; |
|
||||
} |
|
||||
|
|
||||
currentNode = xRememberNode; |
|
||||
|
|
||||
for (int k = 0; k < step - j; k++) |
|
||||
{ |
|
||||
if (currentNode.unitPool[0] != null) |
|
||||
{ |
|
||||
if (currentNode.effectInfluenced == false) |
|
||||
{ |
|
||||
influencePreviewPool.Add(currentNode.unitPool[0]); |
|
||||
currentNode = currentNode.unitPool[0]; |
|
||||
} |
|
||||
} |
|
||||
else break; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
//向左下
|
|
||||
xRememberNode = playerNode;//记忆标量归位
|
|
||||
for (int j = 0; j < step; j++) |
|
||||
{ |
|
||||
// surchPoint.y = currentNode.locationY+j+1;
|
|
||||
// surchPoint.x = currentNode.locationX;
|
|
||||
if (j != 0) |
|
||||
{ |
|
||||
if (xRememberNode.unitPool[4] != null) |
|
||||
{ |
|
||||
xRememberNode = xRememberNode.unitPool[4];//延迟一步
|
|
||||
} |
|
||||
else break; |
|
||||
} |
|
||||
|
|
||||
currentNode = xRememberNode; |
|
||||
|
|
||||
for (int k = 0; k < step - j; k++) |
|
||||
{ |
|
||||
if (currentNode.unitPool[5] != null) |
|
||||
{ |
|
||||
if (currentNode.effectInfluenced == false) |
|
||||
{ |
|
||||
influencePreviewPool.Add(currentNode.unitPool[5]); |
|
||||
currentNode = currentNode.unitPool[5]; |
|
||||
} |
|
||||
} |
|
||||
else break; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
//向右
|
|
||||
xRememberNode = playerNode;//记忆标量归位
|
|
||||
for (int j = 0; j < step; j++) |
|
||||
{ |
|
||||
// surchPoint.y = currentNode.locationY+j+1;
|
|
||||
// surchPoint.x = currentNode.locationX;
|
|
||||
if (j != 0) |
|
||||
{ |
|
||||
if (xRememberNode.unitPool[3] != null) |
|
||||
{ |
|
||||
xRememberNode = xRememberNode.unitPool[3];//延迟一步
|
|
||||
} |
|
||||
else break; |
|
||||
} |
|
||||
|
|
||||
currentNode = xRememberNode; |
|
||||
|
|
||||
for (int k = 0; k < step - j; k++) |
|
||||
{ |
|
||||
if (currentNode.unitPool[4] != null) |
|
||||
{ |
|
||||
if (currentNode.effectInfluenced == false) |
|
||||
{ |
|
||||
influencePreviewPool.Add(currentNode.unitPool[4]); |
|
||||
currentNode = currentNode.unitPool[4]; |
|
||||
} |
|
||||
} |
|
||||
else break; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
//向右上
|
|
||||
xRememberNode = playerNode;//记忆标量归位
|
|
||||
for (int j = 0; j < step; j++) |
|
||||
{ |
|
||||
// surchPoint.y = currentNode.locationY+j+1;
|
|
||||
// surchPoint.x = currentNode.locationX;
|
|
||||
if (j != 0) |
|
||||
{ |
|
||||
if (xRememberNode.unitPool[2] != null) |
|
||||
{ |
|
||||
xRememberNode = xRememberNode.unitPool[2];//延迟一步
|
|
||||
} |
|
||||
else break; |
|
||||
} |
|
||||
|
|
||||
currentNode = xRememberNode; |
|
||||
|
|
||||
for (int k = 0; k < step - j; k++) |
|
||||
{ |
|
||||
if (currentNode.unitPool[3] != null) |
|
||||
{ |
|
||||
if (currentNode.effectInfluenced == false) |
|
||||
{ |
|
||||
influencePreviewPool.Add(currentNode.unitPool[3]); |
|
||||
currentNode = currentNode.unitPool[3]; |
|
||||
} |
|
||||
} |
|
||||
else break; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
//向上
|
|
||||
xRememberNode = playerNode;//记忆标量归位
|
|
||||
for (int j = 0; j < step; j++) |
|
||||
{ |
|
||||
// surchPoint.y = currentNode.locationY+j+1;
|
|
||||
// surchPoint.x = currentNode.locationX;
|
|
||||
if (j != 0) |
|
||||
{ |
|
||||
if (xRememberNode.unitPool[1] != null) |
|
||||
{ |
|
||||
xRememberNode = xRememberNode.unitPool[1];//延迟一步
|
|
||||
} |
|
||||
else break; |
|
||||
} |
|
||||
|
|
||||
currentNode = xRememberNode; |
|
||||
|
|
||||
for (int k = 0; k < step - j; k++) |
|
||||
{ |
|
||||
if (currentNode.unitPool[2] != null) |
|
||||
{ |
|
||||
if (currentNode.effectInfluenced == false) |
|
||||
{ |
|
||||
influencePreviewPool.Add(currentNode.unitPool[2]); |
|
||||
currentNode = currentNode.unitPool[2]; |
|
||||
} |
|
||||
} |
|
||||
else break; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
//向左上
|
|
||||
xRememberNode = playerNode;//记忆标量归位
|
|
||||
for (int j = 0; j < step; j++) |
|
||||
{ |
|
||||
// surchPoint.y = currentNode.locationY+j+1;
|
|
||||
// surchPoint.x = currentNode.locationX;
|
|
||||
if (j != 0) |
|
||||
{ |
|
||||
if (xRememberNode.unitPool[0] != null) |
|
||||
{ |
|
||||
xRememberNode = xRememberNode.unitPool[0];//延迟一步
|
|
||||
} |
|
||||
else break; |
|
||||
} |
|
||||
|
|
||||
currentNode = xRememberNode; |
|
||||
|
|
||||
for (int k = 0; k < step - j; k++) |
|
||||
{ |
|
||||
if (currentNode.unitPool[1] != null) |
|
||||
{ |
|
||||
if (currentNode.effectInfluenced == false) |
|
||||
{ |
|
||||
influencePreviewPool.Add(currentNode.unitPool[1]); |
|
||||
currentNode = currentNode.unitPool[1]; |
|
||||
} |
|
||||
} |
|
||||
else break; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
List<MapUnity> disInfluencePreviewPool = influencePreviewPool.Distinct(new MapUnityCompare()).ToList (); |
|
||||
influencePreviewPool.Clear(); |
|
||||
foreach (var i in disInfluencePreviewPool ) |
|
||||
{ |
|
||||
influencePreviewPool.Add(i); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
//比较类
|
|
||||
class MapUnityCompare : IEqualityComparer<MapUnity> |
|
||||
{ |
|
||||
public bool Equals(MapUnity x, MapUnity y) |
|
||||
{ |
|
||||
if((x.locationX == y.locationX)&&(x.locationY == y.locationY)) |
|
||||
{ |
|
||||
return true; |
|
||||
} |
|
||||
return false; |
|
||||
} |
|
||||
|
|
||||
public int GetHashCode(MapUnity obj) |
|
||||
{ |
|
||||
return obj.locationX.GetHashCode() ^ obj.locationY.GetHashCode(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: f8793b4e36c078945a2ad3a3dc66cb30 |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 30 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
File diff suppressed because it is too large
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: b93e606dce1c400408bd059eaaa399b2 |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 50 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,77 +0,0 @@ |
|||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using UnityEngine; |
|
||||
|
|
||||
public class EnemyAimLine : MonoBehaviour |
|
||||
{ |
|
||||
public LineRenderer lineRenderer; |
|
||||
public float density =2f; //ÃܶÈ
|
|
||||
public float speed;//ËÙ¶È
|
|
||||
|
|
||||
private Material material; |
|
||||
private int id = Shader.PropertyToID("_MainTex"); |
|
||||
private Vector2 offset = new Vector2(0, 0); |
|
||||
|
|
||||
private float disappearTimer = 2;//Ïûʧʱ¼ä
|
|
||||
public float currentdisappearTime = 0; |
|
||||
|
|
||||
[Header("Ä¿±ê")] |
|
||||
public GameObject aimGamgObject; |
|
||||
|
|
||||
private void OnEnable() |
|
||||
{ |
|
||||
material = lineRenderer.material; |
|
||||
aimGamgObject = GameManager.Instance.player.gameObject; |
|
||||
} |
|
||||
|
|
||||
void Update() |
|
||||
{ |
|
||||
lineRenderer.SetPosition(0, this.transform.position); |
|
||||
lineRenderer.SetPosition(1, aimGamgObject.transform.position); |
|
||||
|
|
||||
float lineLength = (lineRenderer.GetPosition(1) - lineRenderer.GetPosition(0)).magnitude; |
|
||||
material.SetTextureScale(id, new Vector2(lineLength * density, 0)); |
|
||||
|
|
||||
offset -= new Vector2(speed, 0); |
|
||||
material.SetTextureOffset(id, offset); |
|
||||
|
|
||||
if(currentdisappearTime >0) |
|
||||
{ |
|
||||
currentdisappearTime -= Time.deltaTime; |
|
||||
Color color = new Color(1f, 0, 0, (currentdisappearTime/disappearTimer)); |
|
||||
material.color = color; |
|
||||
if(currentdisappearTime /disappearTimer <=0.01) |
|
||||
{ |
|
||||
currentdisappearTime = 0; |
|
||||
this.gameObject.SetActive(false); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void Disappear() |
|
||||
{ |
|
||||
disappearTimer = 2f; |
|
||||
currentdisappearTime = disappearTimer; |
|
||||
} |
|
||||
public void Disappear(int time) |
|
||||
{ |
|
||||
disappearTimer = time; |
|
||||
currentdisappearTime = disappearTimer; |
|
||||
} |
|
||||
public void LateDisappear(int LateTime) |
|
||||
{ |
|
||||
lineRenderer.SetPosition(0, this.transform.position); |
|
||||
lineRenderer.SetPosition(1, GameManager.Instance.player.transform.position); |
|
||||
Color color = new Color(1f, 0, 0, 1f); |
|
||||
material.color = color; |
|
||||
Invoke("Disappear", LateTime); |
|
||||
} |
|
||||
public void Appear() |
|
||||
{ |
|
||||
lineRenderer.SetPosition(0, this.transform.position); |
|
||||
lineRenderer.SetPosition(1, GameManager.Instance.player.transform.position); |
|
||||
Color color = new Color(1f, 0, 0, 1f); |
|
||||
material.color = color; |
|
||||
//this.gameObject.SetActive(true);
|
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: 0e85732096b0d414f9d6f9ea2e10f06f |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,193 +0,0 @@ |
|||||
using System.Collections.Generic; |
|
||||
using UnityEngine; |
|
||||
using UnityEngine.UI; |
|
||||
using System.Linq; |
|
||||
using TMPro; |
|
||||
|
|
||||
public class EnemyUIBar : MonoBehaviour |
|
||||
{ |
|
||||
[Header("常驻角色属性")] |
|
||||
public Image HPBar; |
|
||||
public TMP_Text currentHPText; |
|
||||
public TMP_Text maxHPText; |
|
||||
public TMP_Text sheildText; |
|
||||
public EnemyNode enemyNode; |
|
||||
|
|
||||
[Header("意图图标")] |
|
||||
public Image planImage; |
|
||||
public TMP_Text attackDamageText; |
|
||||
public GameObject moveIcon; |
|
||||
[Header("超出攻击范围图标")] |
|
||||
public GameObject outAttackRange; |
|
||||
[Header("Buff图标显示")] |
|
||||
public List<GameObject> buffIconList = new List<GameObject>(); |
|
||||
public GameObject buffIcon; |
|
||||
public GameObject buffPanle; |
|
||||
|
|
||||
[Header("计数标量")] |
|
||||
public float time; |
|
||||
float lastTime=0; |
|
||||
[Header("Buff详情")] |
|
||||
public BuffInforOnMouse buffInforOnMouse; |
|
||||
[Header("虚血控件")] |
|
||||
public bool isSync = true ;//中断每帧刷新
|
|
||||
public Image expHPBar; |
|
||||
public Image expAfterHPBar; |
|
||||
public ExpHpFlash sheildFlash; |
|
||||
|
|
||||
[Header("意图详情")] |
|
||||
public GameObject planPanle; |
|
||||
public TMP_Text planInforText; |
|
||||
public Transform planPanlePos; |
|
||||
|
|
||||
private void Update() |
|
||||
{ |
|
||||
if(isSync ) |
|
||||
{ |
|
||||
sheildText.text = enemyNode.EnemyState.shieldValue.ToString(); |
|
||||
currentHPText.text = enemyNode.EnemyState.currentHP.ToString(); |
|
||||
} |
|
||||
|
|
||||
HPBar.fillAmount = enemyNode .EnemyState .currentHP /enemyNode .EnemyState .maxHP; |
|
||||
maxHPText.text = enemyNode.EnemyState.maxHP.ToString(); |
|
||||
|
|
||||
|
|
||||
} |
|
||||
|
|
||||
//切换意图
|
|
||||
public void SwitchIntention(EnemyAction enemyPlanAction) |
|
||||
{ |
|
||||
planImage.sprite = enemyPlanAction.sprite; |
|
||||
|
|
||||
|
|
||||
enemyNode .currentActionScript = enemyPlanAction; |
|
||||
enemyNode.currentActionScript.AttackRange(enemyNode); |
|
||||
//enemyNode.enemy.SettlePlannText(enemyNode.enemy.enemyAction);
|
|
||||
} |
|
||||
|
|
||||
//鼠标进入
|
|
||||
private void OnMouseEnter() |
|
||||
{ |
|
||||
|
|
||||
if (TurnMaster.Instance.turn == TurnMaster.Turn.playerTurn && GameManager.Instance.onDrag == false && (TurnMaster.Instance.playerAction == TurnMaster.PlayerAction.none|| TurnMaster.Instance.playerAction == TurnMaster.PlayerAction.banAction)) |
|
||||
{ |
|
||||
//意图显示
|
|
||||
ShowPlanInfor(); |
|
||||
//buff显示
|
|
||||
buffInforOnMouse.ShowBuffInfor(); |
|
||||
|
|
||||
//显示攻击范围
|
|
||||
if (enemyNode.currentActionScript != null) |
|
||||
{ |
|
||||
//重新计算攻击范围
|
|
||||
MapUnity currentMapUnity = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
//EnemyManager.Instance.AttackRangeInfluencedNode(currentMapUnity, enemyNode.EnemyState.attackRange + enemyNode.getStepRange(), enemyNode.rangePool);
|
|
||||
enemyNode.LoadRange(); |
|
||||
enemyNode.ShowRange(); |
|
||||
//enemyNode.currentActionScript.ShowAttackRange(enemyNode);
|
|
||||
|
|
||||
if (enemyNode.currentActionScript.isAiming) |
|
||||
{ |
|
||||
enemyNode.lineAim.SetActive(true); |
|
||||
enemyNode.lineAim.GetComponent<EnemyAimLine>().Appear(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
//鼠标悬停
|
|
||||
private void OnMouseOver() |
|
||||
{ |
|
||||
/* EnemyManager.Instance. statePanel.SetActive(true); |
|
||||
EnemyManager.Instance.statePanel.transform.position = Mouse.current.position.value; |
|
||||
|
|
||||
EnemyState_SO enemyState = enemyNode.EnemyState; |
|
||||
EnemyManager.Instance.nameText.text = enemyState.enemyName; |
|
||||
EnemyManager.Instance.enemyIcon.sprite = enemyState.enemyIcon; |
|
||||
EnemyManager.Instance.hPText.text = enemyState.currentHP.ToString() + "/" + enemyState.maxHP.ToString(); |
|
||||
EnemyManager.Instance.attackText.text = (enemyState.damage * enemyState.damageMultiplier).ToString (); |
|
||||
EnemyManager.Instance.stepRangeText.text = (enemyState.stepRange * enemyState.stepRangeMultiplier).ToString(); |
|
||||
EnemyManager.Instance.attackRangeText.text = enemyState.attackRange.ToString(); |
|
||||
EnemyManager.Instance.speedText.text = enemyState.speed.ToString(); |
|
||||
*/ |
|
||||
//攻击范围显示
|
|
||||
/* if (TurnMaster.Instance.turn == TurnMaster.Turn.playerTurn && GameManager.Instance.onDrag == false && TurnMaster.Instance.servantAction != TurnMaster.ServantAction.useSkill) |
|
||||
{ |
|
||||
// MapUnity currentMapUnity = getNodeTools.LocationToGetNode(enemyNode.positionX,enemyNode.positionY);
|
|
||||
if (enemyNode.currentActionScript != null) |
|
||||
{ |
|
||||
enemyNode.currentActionScript.ShowAttackRange(enemyNode); |
|
||||
|
|
||||
if (enemyNode.currentActionScript.isAiming) |
|
||||
{ |
|
||||
enemyNode.lineAim.SetActive(true); |
|
||||
enemyNode.lineAim.GetComponent<EnemyAimLine>().Appear(); |
|
||||
} |
|
||||
} |
|
||||
}*/ |
|
||||
|
|
||||
} |
|
||||
private void OnMouseExit() |
|
||||
{ |
|
||||
//攻击范围关闭
|
|
||||
// EnemyManager.Instance.statePanel.SetActive(false);
|
|
||||
|
|
||||
enemyNode.lineAim.SetActive(false); |
|
||||
//遍历影响池变色
|
|
||||
if (enemyNode != null && enemyNode.currentActionScript!= null) |
|
||||
{ |
|
||||
enemyNode.currentActionScript.FadeAttackRange(enemyNode); |
|
||||
} |
|
||||
//意图详情关闭
|
|
||||
planPanle.SetActive(false); |
|
||||
//buff详情关闭
|
|
||||
buffInforOnMouse.FadeBuffInfor(); |
|
||||
} |
|
||||
|
|
||||
//意图详情显示
|
|
||||
public void ShowPlanInfor() |
|
||||
{ |
|
||||
planInforText.text = enemyNode.stateText; |
|
||||
planPanle.SetActive(true); |
|
||||
|
|
||||
Vector3 screenPos = Camera.main.WorldToScreenPoint(planPanlePos .position); |
|
||||
Vector3 worldPos = Camera.main.ScreenToWorldPoint(new Vector3(screenPos.x, screenPos.y, 7));//世界坐标转视图坐标,把位置拉到近摄像机平面
|
|
||||
planPanle.transform.position = worldPos; |
|
||||
} |
|
||||
//异常Buff显示
|
|
||||
public void RefreshEnemyBuffIcon() |
|
||||
{ |
|
||||
|
|
||||
EnemyState_SO EnemyState = enemyNode.EnemyState; |
|
||||
//先清空
|
|
||||
foreach (var icon in buffIconList) |
|
||||
{ |
|
||||
Destroy(icon); |
|
||||
} |
|
||||
buffIconList.Clear(); |
|
||||
buffInforOnMouse.buffNodeList.Clear(); |
|
||||
//再刷新
|
|
||||
foreach (var key in EnemyState.abnormalCondition.Keys.ToList()) |
|
||||
{ |
|
||||
if (EnemyState.abnormalCondition[key].value > 0) |
|
||||
{ |
|
||||
var buff = Instantiate(buffIcon, buffPanle.transform); |
|
||||
EnemyState.abnormalCondition[key].EnemyUIShow(buff, key, enemyNode); |
|
||||
|
|
||||
//装配buffNode
|
|
||||
BuffNode buffNode = buff.GetComponent<BuffNode>(); |
|
||||
buffNode.buffName = key; |
|
||||
buffNode.buffValue = EnemyState.abnormalCondition[key].value.ToString(); |
|
||||
buffNode.buffIcon = buff.transform.GetChild(0).GetComponent<Image>().sprite; |
|
||||
buffInforOnMouse.buffNodeList.Add(buffNode); |
|
||||
|
|
||||
buffIconList.Add(buff); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: aa7e6a934ffbf8943a251ae27afd29ba |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,155 +0,0 @@ |
|||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using UnityEngine; |
|
||||
|
|
||||
public class FailedSample: Enemy |
|
||||
{ |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
private void Start() |
|
||||
{ |
|
||||
enemyNode = GetComponent<EnemyNode>(); |
|
||||
//enemyNode.sufferAbnormalCondition(AbnormalCondition.corrode, 1);
|
|
||||
enemyNode.sufferAbnormalCondition(AbnormalCondition.Buff_FailedSample, 1); |
|
||||
actionPool.Add(EnemyPlanUIManager.Instance.NewAction(EnemyPlanUIFunction.attackAndPollute), 1.0f); |
|
||||
|
|
||||
GameManager.Instance.PlayerMove += SettleRangeAttack; |
|
||||
} |
|
||||
private void OnDestroy() |
|
||||
{ |
|
||||
if (GameManager.Instance != null) |
|
||||
GameManager.Instance.PlayerMove -= SettleRangeAttack; |
|
||||
} |
|
||||
|
|
||||
public override void ActionValRandom() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyAction_AttackAndPollution: |
|
||||
enemyNode.currentActionScript.colA = MathTool.RandomTarget(enemyNode.EnemyState.damage, 0.1f); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
public override void SettleRangeAttack() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyAction_AttackAndPollution: |
|
||||
enemyNode.enemyUIBar.outAttackRange.SetActive(!enemyNode.rangePool.Contains(GameManager.Instance.playerOn)); |
|
||||
break; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
public override void SettlePlannText(EnemyAction currentAction) |
|
||||
{ |
|
||||
switch (currentAction) |
|
||||
{ |
|
||||
case EnemyAction_AttackAndPollution: |
|
||||
//改变文本
|
|
||||
string attackText = enemyNode.DamageCalculation(enemyNode.currentActionScript.colA).ToString(); |
|
||||
string stepRangeText = enemyNode.getStepRange().ToString(); |
|
||||
enemyNode.currentActionScript.SettleText(enemyNode, attackText, "造成" + attackText + "点伤害并随机污染附近三个地块。至多移动" + stepRangeText + "个格子。移动时污染所站地块。"); |
|
||||
break; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public override IEnumerator JudgeActionCoroutine()//等移动到位置就判断是否还能走
|
|
||||
{ |
|
||||
UnityEngine.Debug.Log("真正行动是:" + enemyAction); |
|
||||
switch (enemyAction) |
|
||||
{ |
|
||||
case EnemyAction_AttackAndPollution: |
|
||||
yield return StartCoroutine(MeleeAttackAction()); |
|
||||
break; |
|
||||
} |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (Name.NodeColor.EnemyColor.Contains(currentNode.whoColour)) |
|
||||
{ |
|
||||
yield return null; |
|
||||
} |
|
||||
HashSet<string> targetDebuff = new HashSet<string>(); |
|
||||
HashSet<string> debuffList = new HashSet<string>(AbnormalCondition.enemyDebuffList); |
|
||||
targetDebuff = MathTool.GetRandomElements(debuffList, 1); |
|
||||
enemyNode.sufferAbnormalCondition(targetDebuff.FirstOrDefault(), 2); |
|
||||
} |
|
||||
|
|
||||
public override void BoolCheck() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyAction_AttackAndPollution: |
|
||||
canMove = true; |
|
||||
canAttack = true; |
|
||||
canAoe = false; |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
public override IEnumerator MeleeAttackAction() |
|
||||
{ |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
HashSet<MapUnity> targets = new HashSet<MapUnity> { currentNode}; |
|
||||
getNodeTools.getCircleNode(targets, 1); |
|
||||
targets.Remove(currentNode); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
yield return StartCoroutine(enemyNode.MeleeAttackAim()); |
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AttackDamage(enemyNode.currentActionScript.colA, 1); |
|
||||
RandomPollute(targets, 3); |
|
||||
RandomPollute(new HashSet<MapUnity> { currentNode }, 1); |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
yield return StartCoroutine(moveTowardsPlayer()); |
|
||||
yield return new WaitForSeconds(1); |
|
||||
currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
yield return StartCoroutine(enemyNode.MeleeAttackAim()); |
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AttackDamage(enemyNode.currentActionScript.colA,1); |
|
||||
RandomPollute(targets, 3); |
|
||||
RandomPollute(new HashSet<MapUnity> { currentNode }, 1); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: 5d91be1662d0ad545add1773ee2fad39 |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,203 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using UnityEngine; |
|
||||
|
|
||||
public class Gravitus : Enemy |
|
||||
{ |
|
||||
|
|
||||
|
|
||||
|
|
||||
private void Start() |
|
||||
{ |
|
||||
actionPool.Add(EnemyPlanUIManager.Instance.NewAction(EnemyPlanUIFunction.spell), 0.3f); |
|
||||
actionPool.Add(EnemyPlanUIManager.Instance.NewAction(EnemyPlanUIFunction.attackAndPollute), 0.3f); |
|
||||
actionPool.Add(EnemyPlanUIManager.Instance.NewAction(EnemyPlanUIFunction.spellAndShield), 0.4f); |
|
||||
|
|
||||
GameManager.Instance.PlayerMove += SettleRangeAttack; |
|
||||
} |
|
||||
|
|
||||
private void OnDestroy() |
|
||||
{ |
|
||||
if (GameManager.Instance != null) |
|
||||
GameManager.Instance.PlayerMove -= SettleRangeAttack; |
|
||||
} |
|
||||
public override void SettleRangeAttack() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyAction_Spell: |
|
||||
enemyNode.enemyUIBar.outAttackRange.SetActive(false); |
|
||||
break; |
|
||||
case EnemyAction_SpellAndShield: |
|
||||
enemyNode.enemyUIBar.outAttackRange.SetActive(false); |
|
||||
break; |
|
||||
case EnemyAction_AttackAndPollution: |
|
||||
enemyNode.enemyUIBar.outAttackRange.SetActive(!enemyNode.rangePool.Contains(GameManager.Instance.playerOn)); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public override void ActionValRandom() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyAction_AttackAndPollution: |
|
||||
enemyNode.currentActionScript.colA = MathTool.RandomTarget(enemyNode.EnemyState.damage, 0.1f); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
public override void SettlePlannText(EnemyAction currentAction) |
|
||||
{ |
|
||||
switch (currentAction) |
|
||||
{ |
|
||||
case EnemyAction_Spell: |
|
||||
enemyNode.currentActionScript.SettleText(enemyNode, " ", "对玩家施加一层致残"); |
|
||||
break; |
|
||||
case EnemyAction_SpellAndShield: |
|
||||
enemyNode.currentActionScript.SettleText(enemyNode, " ", "吸收2范围内污染地块,获得吸收数量*2的护盾"); |
|
||||
break; |
|
||||
case EnemyAction_AttackAndPollution: |
|
||||
string attackText = enemyNode.DamageCalculation(enemyNode.currentActionScript.colA).ToString(); |
|
||||
string stepRangeText = enemyNode.getStepRange().ToString(); |
|
||||
enemyNode.currentActionScript.SettleText(enemyNode, attackText, "造成" + attackText + "点伤害并污染其1范围地块"); |
|
||||
break; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
} |
|
||||
public override IEnumerator JudgeActionCoroutine()//等移动到位置就判断是否还能走
|
|
||||
{ |
|
||||
Debug.Log("真正行动是:" + enemyAction); |
|
||||
switch (enemyAction) |
|
||||
{ |
|
||||
case EnemyAction_Spell: |
|
||||
yield return StartCoroutine(DebuffAction()); |
|
||||
break; |
|
||||
case EnemyAction_SpellAndShield: |
|
||||
yield return StartCoroutine(PolluteAction()); |
|
||||
break; |
|
||||
case EnemyAction_AttackAndPollution: |
|
||||
yield return StartCoroutine(MeleeAttackAction()); |
|
||||
break; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public override void BoolCheck() |
|
||||
{ |
|
||||
switch (enemyNode.currentActionScript) |
|
||||
{ |
|
||||
case EnemyAction_Spell: |
|
||||
canMove = false; |
|
||||
canAttack = false; |
|
||||
canAoe = false; |
|
||||
break; |
|
||||
case EnemyAction_SpellAndShield: |
|
||||
canMove = false; |
|
||||
canAttack = false; |
|
||||
canAoe = false; |
|
||||
break; |
|
||||
case EnemyAction_AttackAndPollution: |
|
||||
canMove = true; |
|
||||
canAttack = true; |
|
||||
canAoe = false; |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public override IEnumerator MeleeAttackAction() |
|
||||
{ |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
HashSet<MapUnity> targetSet=new HashSet<MapUnity> { GameManager.Instance.playerOn }; |
|
||||
getNodeTools.getCircleNodeForEnemy(targetSet, 1); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
yield return StartCoroutine(enemyNode.MeleeAttackAim()); |
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AttackDamage(enemyNode.currentActionScript.colA, 1); |
|
||||
PolluteNodes(targetSet,Name.NodeColor.Black); |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
yield return StartCoroutine(moveTowardsPlayer()); |
|
||||
yield return new WaitForSeconds(1); |
|
||||
currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (getNodeTools.canRemoteAttack(currentNode, enemyNode.EnemyState.attackRange)) |
|
||||
{ |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
yield return StartCoroutine(enemyNode.MeleeAttackAim()); |
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AttackDamage(enemyNode.currentActionScript.colA, 1); |
|
||||
PolluteNodes(targetSet, Name.NodeColor.Black); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public IEnumerator ThrowAttackAction(int count) |
|
||||
{ |
|
||||
int range = 2; |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
if (currentNode.whoColour == Name.NodeColor.Black) |
|
||||
{ |
|
||||
range = 3; |
|
||||
} |
|
||||
if (!enemyNode.EnemyState.abnormalCondition.ContainsKey(AbnormalCondition.disarm)) |
|
||||
{ |
|
||||
//yield return StartCoroutine(enemyNode.MeleeAttackAim());
|
|
||||
// enemyNode.anim.SetTrigger("MeleeAttack");
|
|
||||
// yield return new WaitForSeconds(0.5f);
|
|
||||
AoeDamage(getNodeTools.getNodesCount(Name.Color.Black), count, GameManager.Instance.playerOn, range); |
|
||||
} |
|
||||
yield return null; |
|
||||
} |
|
||||
|
|
||||
public IEnumerator DebuffAction() |
|
||||
{ |
|
||||
Usermanager.Instance.SufferPlayerAbnormalCondition(AbnormalCondition.disable, 1); |
|
||||
yield return new WaitForSeconds(0.5f); |
|
||||
} |
|
||||
|
|
||||
public IEnumerator PolluteAction() |
|
||||
{ |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(enemyNode.positionX, enemyNode.positionY); |
|
||||
targets = new HashSet<MapUnity> { currentNode }; |
|
||||
getNodeTools.getCircleNodeForBoom(targets, 2); |
|
||||
int count = ClearNodesReturnCount(targets); |
|
||||
enemyNode.EnemyState.shieldValue += count * 2; |
|
||||
yield return new WaitForSeconds(0.5f); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: 6d462e2453c896341b99bbf6392d8e38 |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,50 +0,0 @@ |
|||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using UnityEngine; |
|
||||
|
|
||||
public class BlockNode : EnemyNode |
|
||||
{ |
|
||||
[Header("已破坏标志,防止重复触发效果")] |
|
||||
public bool isDestroying; |
|
||||
[Header("破坏时粒子效果")] |
|
||||
public GameObject destroyParticle; |
|
||||
public void OnEnable() |
|
||||
{ |
|
||||
EnemyManager.Instance.enemyObservers.Add(this); |
|
||||
|
|
||||
if (templateEnemyState != null) |
|
||||
EnemyState = Instantiate(templateEnemyState); |
|
||||
|
|
||||
blockUIBar = GetComponent<BlockUIBar>(); |
|
||||
} |
|
||||
|
|
||||
private void OnDisable() |
|
||||
{ |
|
||||
if (EnemyManager.Instance != null) |
|
||||
{ |
|
||||
EnemyManager.Instance.enemyObservers.Remove(this); |
|
||||
} |
|
||||
} |
|
||||
private void Start() |
|
||||
{ |
|
||||
if (blockUIBar == null) |
|
||||
{ |
|
||||
CreatEnemyUIBar(this); |
|
||||
} |
|
||||
lasteHp = (int)EnemyState.currentHP; |
|
||||
} |
|
||||
public override void CreatEnemyUIBar(EnemyNode enemyNode) |
|
||||
{ |
|
||||
followPoint.localPosition = followPointPostion; |
|
||||
enemyUI = Instantiate(EnemyManager.Instance.blockUIBar , enemyNode.followPoint.position, followPoint.rotation); |
|
||||
enemyUI.transform.SetParent(enemyNode.transform); |
|
||||
blockUIBar = enemyUI.GetComponent<BlockUIBar>(); |
|
||||
blockUIBar.CreatSartHp(EnemyState.currentNumberOfHits); |
|
||||
// blockUIBar.enemyNode = enemyNode;
|
|
||||
} |
|
||||
|
|
||||
public override void OnDeath() |
|
||||
{ |
|
||||
Destroy(this.gameObject); |
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: cf819d57070dbab4a95ad54cedacd2fa |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,141 +0,0 @@ |
|||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using UnityEngine; |
|
||||
|
|
||||
public class Boom : BlockNode |
|
||||
{ |
|
||||
public int damage = 4; |
|
||||
public override void OnDeath() |
|
||||
{ |
|
||||
// StartCoroutine(BoomdAndDestory());
|
|
||||
} |
|
||||
public override IEnumerator ActiveEffect() |
|
||||
{ |
|
||||
if (isDestroying == false) |
|
||||
{ |
|
||||
isDestroying = true; |
|
||||
yield return StartCoroutine(BoomdAndDestory()); |
|
||||
} |
|
||||
} |
|
||||
IEnumerator BoomdAndDestory() |
|
||||
{ |
|
||||
//计算角度
|
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(positionX,positionY); |
|
||||
yield return StartCoroutine(CAngle(currentNode)); |
|
||||
currentNode.blocked = false; |
|
||||
currentNode.enemyNode = null; |
|
||||
//结算旋涡
|
|
||||
GameManager.Instance.BroadCastWhirlpoolEffectSycn(); |
|
||||
//生成爆炸特效并摧毁此物体
|
|
||||
Instantiate(destroyParticle, transform.position, destroyParticle.transform.rotation); |
|
||||
yield return null; |
|
||||
Destroy(this.gameObject); |
|
||||
yield break; |
|
||||
} |
|
||||
public override List<MapUnity> PreviewColorRange() |
|
||||
{ |
|
||||
MapUnity currentNode = getNodeTools.LocationToGetNode(positionX, positionY); |
|
||||
List<MapUnity> effectRangePreviewPool = new List<MapUnity>(); |
|
||||
|
|
||||
Vector3 direction = transform.position - GameManager.Instance.player.transform.position; |
|
||||
float angle1 = Vector3.SignedAngle(transform.forward, direction, transform.up); |
|
||||
|
|
||||
if (angle1 < 0) |
|
||||
{ |
|
||||
angle1 += 360f; |
|
||||
} |
|
||||
if (angle1 >= 300f) |
|
||||
{ |
|
||||
angle1 = 330f; |
|
||||
} |
|
||||
else if (angle1 >= 240f) |
|
||||
{ |
|
||||
angle1 = 270f; |
|
||||
} |
|
||||
else if (angle1 >= 180f) |
|
||||
{ |
|
||||
angle1 = 210f; |
|
||||
} |
|
||||
else if (angle1 >= 120f) |
|
||||
{ |
|
||||
angle1 = 150f; |
|
||||
} |
|
||||
else if (angle1 >= 60f) |
|
||||
{ |
|
||||
angle1 = 90f; |
|
||||
} |
|
||||
else if (angle1 >= 0f) |
|
||||
{ |
|
||||
angle1 = 30f; |
|
||||
} |
|
||||
|
|
||||
effectRangePreviewPool = getNodeTools.setEffectRangePreviewNoCard("4_1", angle1, currentNode).ToList(); |
|
||||
|
|
||||
foreach (var mapNode in effectRangePreviewPool) |
|
||||
{ |
|
||||
// Vector3 pos = mapNode.transform.position;
|
|
||||
// pos.y = particlePoint.position.y;
|
|
||||
// var bluePartical = Instantiate(ParticalManager.Instance.redParticleEffect,pos, ParticalManager.Instance.redParticleEffect.transform.rotation);
|
|
||||
// bluePartical.transform.SetParent(currentNode.transform);
|
|
||||
mapNode.switchPreColor(currentNode.colorUnderAttack); |
|
||||
} |
|
||||
return effectRangePreviewPool; |
|
||||
} |
|
||||
IEnumerator CAngle(MapUnity currentNode) |
|
||||
{ |
|
||||
List<MapUnity> effectRangePreviewPool = new List<MapUnity>(); |
|
||||
|
|
||||
Vector3 direction = transform.position- GameManager.Instance.player.transform.position ; |
|
||||
float angle1 = Vector3.SignedAngle(transform.forward, direction, transform.up); |
|
||||
|
|
||||
if (angle1 < 0) |
|
||||
{ |
|
||||
angle1 += 360f; |
|
||||
} |
|
||||
if (angle1 >= 300f) |
|
||||
{ |
|
||||
angle1 = 330f; |
|
||||
} |
|
||||
else if (angle1 >= 240f) |
|
||||
{ |
|
||||
angle1 = 270f; |
|
||||
} |
|
||||
else if (angle1 >= 180f) |
|
||||
{ |
|
||||
angle1 = 210f; |
|
||||
} |
|
||||
else if (angle1 >= 120f) |
|
||||
{ |
|
||||
angle1 = 150f; |
|
||||
} |
|
||||
else if (angle1 >= 60f) |
|
||||
{ |
|
||||
angle1 = 90f; |
|
||||
} |
|
||||
else if (angle1 >= 0f) |
|
||||
{ |
|
||||
angle1 = 30f; |
|
||||
} |
|
||||
|
|
||||
effectRangePreviewPool = getNodeTools.setEffectRangePreviewNoCard("4_1", angle1, currentNode).ToList (); |
|
||||
|
|
||||
// SettlementManager.Instance.damageWork(damage, effectRangePreviewPool, -1);
|
|
||||
|
|
||||
foreach (var mapNode in effectRangePreviewPool ) |
|
||||
{ |
|
||||
// Vector3 pos = mapNode.transform.position;
|
|
||||
// pos.y = particlePoint.position.y;
|
|
||||
// var bluePartical = Instantiate(ParticalManager.Instance.redParticleEffect,pos, ParticalManager.Instance.redParticleEffect.transform.rotation);
|
|
||||
// bluePartical.transform.SetParent(currentNode.transform);
|
|
||||
mapNode.switchColor(currentNode. colorUnderAttack); |
|
||||
if(mapNode .enemyNode != null ) |
|
||||
{ |
|
||||
mapNode.enemyNode.EnemyState.currentHP -= 4; |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
|
|
||||
yield return null; |
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: 4e23452b3c4954f409d3aecbaa273cb7 |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,51 +0,0 @@ |
|||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using UnityEngine; |
|
||||
|
|
||||
public class Box : MonoBehaviour |
|
||||
{ |
|
||||
EnemyNode enemyNode; |
|
||||
|
|
||||
[Header("±¦Ï佱Ʒ")] |
|
||||
public List<GameObject> rewardList = new List<GameObject>(); |
|
||||
|
|
||||
public enum BlockType |
|
||||
{ |
|
||||
block, |
|
||||
rock, |
|
||||
box |
|
||||
} |
|
||||
public BlockType blockType; |
|
||||
|
|
||||
private void Start() |
|
||||
{ |
|
||||
enemyNode = GetComponent<EnemyNode>(); |
|
||||
} |
|
||||
|
|
||||
public void OnDeath() |
|
||||
{ |
|
||||
//Çå³ý
|
|
||||
switch (blockType) |
|
||||
{ |
|
||||
case BlockType.block: |
|
||||
MapUnity currentNode = GameManager.Instance.X[enemyNode.positionX].Y[enemyNode.positionY]; |
|
||||
currentNode.enemyNode = null; |
|
||||
currentNode.blocked = false; |
|
||||
Destroy(this.gameObject); |
|
||||
break; |
|
||||
case BlockType.rock: |
|
||||
break; |
|
||||
case BlockType.box: |
|
||||
//Éú³É½±Àø
|
|
||||
if (rewardList.Count > 0) |
|
||||
{ |
|
||||
Instantiate(rewardList[Random.Range(0, rewardList.Count)], this.transform.position, Quaternion.identity); |
|
||||
} |
|
||||
MapUnity current = GameManager.Instance.X[enemyNode.positionX].Y[enemyNode.positionY]; |
|
||||
current.enemyNode = null; |
|
||||
current.blocked = false; |
|
||||
Destroy(this.gameObject); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: 58499696b45f72a4184c1a705407a923 |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,59 +0,0 @@ |
|||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using UnityEngine; |
|
||||
|
|
||||
public class TNTBucket : BlockNode |
|
||||
{ |
|
||||
public override void OnDeath() |
|
||||
{ |
|
||||
// StartCoroutine(BoomdAndDestory());
|
|
||||
} |
|
||||
public override IEnumerator ActiveEffect() |
|
||||
{ |
|
||||
if (isDestroying == false) |
|
||||
{ |
|
||||
isDestroying = true; |
|
||||
yield return StartCoroutine(DrawCardAndDestory()); |
|
||||
} |
|
||||
} |
|
||||
IEnumerator DrawCardAndDestory() |
|
||||
{ |
|
||||
MapUnity mapUnity = getNodeTools.LocationToGetNode(positionX, positionY); |
|
||||
foreach (var node in mapUnity.unitPool ) |
|
||||
{ |
|
||||
if(node != null && node .gameObject .activeInHierarchy ==true ) |
|
||||
{ |
|
||||
node.switchColor(mapUnity . colorUnderAttack); |
|
||||
if (node .enemyNode != null) |
|
||||
{ |
|
||||
node.enemyNode.EnemyState.currentHP -= 4; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
mapUnity.blocked = false; |
|
||||
mapUnity.enemyNode = null; |
|
||||
//结算旋涡
|
|
||||
yield return null; |
|
||||
GameManager.Instance.BroadCastWhirlpoolEffectSycn(); |
|
||||
//生成爆炸特效并摧毁此物体
|
|
||||
Instantiate(destroyParticle, transform.position, destroyParticle.transform.rotation); |
|
||||
yield return null; |
|
||||
Destroy(this.gameObject); |
|
||||
yield break; |
|
||||
} |
|
||||
|
|
||||
public override List<MapUnity> PreviewColorRange() |
|
||||
{ |
|
||||
MapUnity mapUnity = getNodeTools.LocationToGetNode(positionX, positionY); |
|
||||
List<MapUnity> effectRangePreviewPool = new List<MapUnity>(); |
|
||||
foreach (var node in mapUnity.unitPool) |
|
||||
{ |
|
||||
if (node != null) |
|
||||
{ |
|
||||
effectRangePreviewPool.Add(node); |
|
||||
node.switchPreColor(mapUnity.colorUnderAttack); |
|
||||
} |
|
||||
} |
|
||||
return effectRangePreviewPool; |
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: 37b795f1ee3c9514388b0e658e09a7cb |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,40 +0,0 @@ |
|||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using UnityEngine; |
|
||||
|
|
||||
public class Tree : BlockNode |
|
||||
{ |
|
||||
public int drawCardCount=2; |
|
||||
public override void OnDeath() |
|
||||
{ |
|
||||
/*if (Usermanager.playerAbnormalCondition.ContainsKey(AbnormalCondition.banDrawCard)) |
|
||||
{ |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
StartCoroutine(DrawCardAndDestory()); |
|
||||
}*/ |
|
||||
} |
|
||||
public override IEnumerator ActiveEffect() |
|
||||
{ |
|
||||
if(isDestroying ==false ) |
|
||||
{ |
|
||||
isDestroying = true; |
|
||||
yield return StartCoroutine(DrawCardAndDestory()); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
IEnumerator DrawCardAndDestory() |
|
||||
{ |
|
||||
MapUnity mapUnity = getNodeTools.LocationToGetNode(positionX, positionY); |
|
||||
yield return TurnMaster.Instance.StartCoroutine(TurnMaster.Instance.drawCards(drawCardCount)); |
|
||||
mapUnity.blocked = false; |
|
||||
mapUnity.enemyNode = null; |
|
||||
|
|
||||
//生成爆炸特效并摧毁此物体
|
|
||||
Instantiate(destroyParticle, transform.position, destroyParticle.transform.rotation); |
|
||||
yield return null; |
|
||||
Destroy(this.gameObject); |
|
||||
yield break; |
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
fileFormatVersion: 2 |
|
||||
guid: 7ab239a945e04874b9c7b6623dafa738 |
|
||||
MonoImporter: |
|
||||
externalObjects: {} |
|
||||
serializedVersion: 2 |
|
||||
defaultReferences: [] |
|
||||
executionOrder: 0 |
|
||||
icon: {instanceID: 0} |
|
||||
userData: |
|
||||
assetBundleName: |
|
||||
assetBundleVariant: |
|
||||
@ -1,25 +0,0 @@ |
|||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using UnityEngine; |
|
||||
using UnityEngine.UIElements; |
|
||||
|
|
||||
public class Vacancy : BlockNode |
|
||||
{ |
|
||||
public int drawCardCount = 2; |
|
||||
private void Start() |
|
||||
{ |
|
||||
if (blockUIBar == null) |
|
||||
{ |
|
||||
CreatEnemyUIBar(this); |
|
||||
|
|
||||
} |
|
||||
lasteHp = (int)EnemyState.currentHP; |
|
||||
enemyUI.SetActive(false); |
|
||||
} |
|
||||
public override void OnDeath() |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
} |
|
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue