| | |
| | | using KTGMGemClient; |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | using DG.Tweening; |
| | | using KTGMGemClient; |
| | | using System; |
| | | using ActionGameFramework.Health; |
| | | using Core.Utilities; |
| | |
| | | /// </summary> |
| | | public class Tower : Targetable |
| | | { |
| | | public readonly float INSCENE_TU_DAMAGE = 30f; |
| | | public static readonly int MAX_LEVEL = 4; |
| | | |
| | | /// <summary> |
| | | /// A generalised name common to a levels |
| | | /// </summary> |
| | |
| | | public EFeatureTower towerFeature = EFeatureTower.NULL; |
| | | |
| | | /// <summary> |
| | | /// 当前塔防对应的MonsterMaterial,自身和对方显示不同的Mat. |
| | | /// </summary> |
| | | public Material materialMonsterSelf; |
| | | public Material materialMonsterOppo; |
| | | |
| | | /// <summary> |
| | | /// 当前塔防对应的攻击和等待Mat. |
| | | /// </summary> |
| | | public Material materialTowerAttackSelf; |
| | | public Material materialTowerWaitSelf; |
| | | public Material materialTowerAttackOppo; |
| | | public Material materialTowerWaitOppo; |
| | | |
| | | /// <summary> |
| | | /// 0 空状态 1 等待状态 2 攻击状态. |
| | | /// </summary> |
| | | protected int curActionState = 0; |
| | | |
| | | /// <summary> |
| | | /// 塔防对应的充能状态. |
| | | /// </summary> |
| | | public ETowerFuntion eTowerFuntion = ETowerFuntion.NULL; |
| | | |
| | | [HideInInspector] |
| | | public BulletUICtl bulletCtl = null; |
| | | |
| | | [HideInInspector] |
| | | public EnergyUICtl energyCtl = null; |
| | | |
| | | [HideInInspector] |
| | | public FreezeBreath FreezeBreathCtrl = null; |
| | | |
| | | /// <summary> |
| | | /// The tower levels associated with this tower |
| | | /// </summary> |
| | | public TowerLevel[] levels; |
| | | [SerializeField] |
| | | private TowerLevel towerLevel; |
| | | |
| | | public TowerLevel CurrentTowerLevel { get; private set; } |
| | | |
| | | /// <summary> |
| | | /// 当前塔防对应的AttributeID. |
| | | /// 精灵id,一一对应 elf_info表中的id,唯一的区分每一种精灵塔 |
| | | /// </summary> |
| | | public int attributeId; |
| | | |
| | | /// <summary> |
| | | /// 当前的Tower在游戏内UI界面上用到的Image数据,再以后应该是直接在表格内配置才合适 |
| | | /// </summary> |
| | | public Sprite uiImage; |
| | | public int ElfId; |
| | | |
| | | /// <summary> |
| | | /// The physics mask the tower searches on |
| | |
| | | public int currentLevel { get; protected set; } |
| | | |
| | | protected bool m_bInAttackMode = false; |
| | | |
| | | /// <summary> |
| | | /// 精英怪和Boss双倍伤害. |
| | | /// </summary> |
| | | public bool bDoubleHitElit = false; |
| | | |
| | | /// <summary> |
| | | /// Reference to the data of the current level |
| | | /// </summary> |
| | | public TowerLevel currentTowerLevel { get; protected set; } |
| | | |
| | | /// <summary> |
| | | /// 攻击增加 |
| | |
| | | |
| | | public bool PlayWaveLineFlash { get; set; } = true; |
| | | |
| | | private bool isBondage; |
| | | |
| | | /// <summary> |
| | | /// 是否是泡泡禁锢状态 |
| | | /// </summary> |
| | | /// <value></value> |
| | | public bool IsBondage |
| | | { |
| | | get { return isBondage; } |
| | | set |
| | | { |
| | | isBondage = value; |
| | | CanAttack = !value; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 禁锢时间 |
| | | /// </summary> |
| | | public float BondageTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 禁锢警告时间 |
| | | /// </summary> |
| | | /// <value></value> |
| | | public float BondageWarningTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 泡泡禁锢期间,点击一次减少的时间 |
| | | /// </summary> |
| | | public float BondageClickDecreaseTime { get; set; } = 1f; |
| | | |
| | | /// <summary> |
| | | /// 是否是木属性蓄力状态 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | public Agent WoodAimAgent; |
| | | |
| | | /// <summary> |
| | | /// 塔防数据的局内升级 |
| | | /// </summary> |
| | | public int inSceneTowerLevel |
| | | { |
| | | get; set; |
| | | } |
| | | |
| | | public int uiProOffset |
| | | { |
| | | get { return progressOffset; } |
| | |
| | | /// <summary> |
| | | /// Gets whether the tower can level up anymore |
| | | /// </summary> |
| | | public bool isAtMaxLevel |
| | | public bool IsMaxLevel |
| | | { |
| | | get { return currentLevel == levels.Length - 1; } |
| | | get { return currentLevel == ElfUpgradeData.MaxTowerLevel - 1; } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public bool CanAttack = true; |
| | | |
| | | public void setTowerState(bool attack) |
| | | /// <summary> |
| | | /// 是否是对手塔防 |
| | | /// </summary> |
| | | public bool opponentSide { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 禁锢警告 |
| | | /// </summary> |
| | | protected GameObject bondageWarningObj; |
| | | |
| | | /// <summary> |
| | | /// 禁锢泡泡 |
| | | /// </summary> |
| | | protected GameObject bondageObj; |
| | | |
| | | private GameObject tapObj; |
| | | |
| | | /// <summary> |
| | | /// 精灵被禁锢时点击次数 |
| | | /// </summary> |
| | | public int BondageTapCount { get; private set; } |
| | | |
| | | private void Update() |
| | | { |
| | | if (!materialTowerAttackSelf) return; |
| | | HandleBondageBubble(); |
| | | } |
| | | |
| | | if (opponentSide) |
| | | /// <summary> |
| | | /// 处理禁锢泡泡技能 |
| | | /// </summary> |
| | | private void HandleBondageBubble() |
| | | { |
| | | if (!IsBondage) return; |
| | | |
| | | if (BondageWarningTime > 0) |
| | | { |
| | | if (attack && (curActionState != 2)) |
| | | { |
| | | currentTowerLevel.SetTowerMonsterMat(materialTowerAttackOppo, true); |
| | | curActionState = 2; |
| | | } |
| | | BondageWarningTime -= Time.deltaTime; |
| | | |
| | | if ((!attack) && (curActionState != 1)) |
| | | if (BondageWarningTime <= 0) |
| | | { |
| | | currentTowerLevel.SetTowerMonsterMat(materialTowerWaitOppo, false); |
| | | curActionState = 1; |
| | | Destroy(bondageWarningObj); |
| | | bondageWarningObj = null; |
| | | StartBondage(); |
| | | ShowTapPrompt(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (attack && (curActionState != 2)) |
| | | { |
| | | currentTowerLevel.SetTowerMonsterMat(materialTowerAttackSelf, true); |
| | | curActionState = 2; |
| | | } |
| | | BondageTime -= Time.deltaTime; |
| | | |
| | | if ((!attack) && (curActionState != 1)) |
| | | if (BondageTime <= 0) |
| | | { |
| | | currentTowerLevel.SetTowerMonsterMat(materialTowerWaitSelf, false); |
| | | curActionState = 1; |
| | | IsBondage = false; |
| | | Destroy(bondageObj); |
| | | bondageObj = null; |
| | | BondageBubbleBomb(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 是否是对手塔防 |
| | | /// 展示连续点击提示 |
| | | /// </summary> |
| | | public bool opponentSide { get; set; } |
| | | private void ShowTapPrompt() |
| | | { |
| | | GameObject prefab = Resources.Load<GameObject>("Prefabs/Endless/BondageBubbleTap"); |
| | | tapObj = Instantiate(prefab); |
| | | tapObj.transform.SetParent(GameObject.Find("MainUI/CoinPanel").transform, false); |
| | | Vector3 worldPos = TowerPlacementGridEndless.instance.GetGridWorldPos(gridPosition.x, gridPosition.y); |
| | | Camera camera = GameObject.Find("SceneCamera3D").GetComponent<Camera>(); |
| | | Vector3 screenPos = camera.WorldToScreenPoint(worldPos); |
| | | screenPos.z = 0; |
| | | screenPos.x += 100; |
| | | screenPos.y += 85; |
| | | tapObj.transform.position = screenPos; |
| | | tapObj.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f); |
| | | |
| | | DOTween.To(() => tapObj.transform.localScale, (Vector3 v) => tapObj.transform.localScale = v, new Vector3(1f, 1f, 1f), 0.3f).SetEase(Ease.OutBack); |
| | | } |
| | | |
| | | private void HideTapPrompt() |
| | | { |
| | | if (tapObj != null) |
| | | { |
| | | Image img = tapObj.GetComponent<Image>(); |
| | | DOTween.To(() => img.color, (Color v) => img.color = v, new Color(1f, 1f, 1f, 0f), 0.3f).OnComplete(() => |
| | | { |
| | | if (tapObj != null) |
| | | { |
| | | Destroy(tapObj); |
| | | tapObj = null; |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | public void OnPressed() |
| | | { |
| | | if (!IsBondage || BondageWarningTime > 0) return; |
| | | |
| | | ++BondageTapCount; |
| | | |
| | | if (BondageTapCount == 1) |
| | | HideTapPrompt(); |
| | | BondageTime -= BondageClickDecreaseTime; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 禁锢泡泡爆炸 |
| | | /// </summary> |
| | | private void BondageBubbleBomb() |
| | | { |
| | | GameObject prefab = Resources.Load<GameObject>("Prefabs/Endless/BondageBubbleBomb"); |
| | | GameObject obj = Instantiate(prefab); |
| | | obj.transform.SetParent(TowerPlacementGridEndless.instance.GridContainer.transform, false); |
| | | obj.transform.position = TowerPlacementGridEndless.instance.GetGridWorldPos(gridPosition.x, gridPosition.y); |
| | | obj.transform.GetChild(0).GetComponent<ParticleSystem>().Play(); |
| | | Destroy(obj, 1.2f); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 开始泡泡禁锢 |
| | | /// </summary> |
| | | private void StartBondage() |
| | | { |
| | | BondageTapCount = 0; |
| | | GameObject prefab = Resources.Load<GameObject>("Prefabs/Endless/BondageBubble"); |
| | | bondageObj = Instantiate(prefab); |
| | | bondageObj.transform.SetParent(TowerPlacementGridEndless.instance.GridContainer.transform, false); |
| | | bondageObj.transform.position = TowerPlacementGridEndless.instance.GetGridWorldPos(gridPosition.x, gridPosition.y); |
| | | bondageObj.transform.GetChild(0).GetComponent<ParticleSystem>().Play(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 禁锢警告 |
| | | /// </summary> |
| | | /// <param name="tower"></param> |
| | | public void BondageWarning() |
| | | { |
| | | GameObject prefab = Resources.Load<GameObject>("Prefabs/Endless/BondageBubbleWarning"); |
| | | bondageWarningObj = Instantiate(prefab); |
| | | bondageWarningObj.transform.SetParent(TowerPlacementGridEndless.instance.GridContainer.transform, false); |
| | | bondageWarningObj.transform.position = TowerPlacementGridEndless.instance.GetGridWorldPos(gridPosition.x, gridPosition.y); |
| | | bondageWarningObj.transform.GetChild(0).GetComponent<ParticleSystem>().Play(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 播放充能状态特效. |
| | |
| | | set |
| | | { |
| | | m_bInAttackMode = value; |
| | | currentTowerLevel.SetAffectorState(m_bInAttackMode, gridPosition.x); |
| | | currentTowerLevel.SetAttackState(value); |
| | | CurrentTowerLevel.SetAffectorState(m_bInAttackMode, gridPosition.x); |
| | | CurrentTowerLevel.SetAttackState(value); |
| | | |
| | | if (value) |
| | | { |
| | | if (opponentSide) |
| | | { |
| | | OpponentMgr.instance.SetTowerAttID(gridPosition.x, attributeId, currentLevel); |
| | | OpponentMgr.instance.SetTowerAttID(gridPosition.x, ElfId, currentLevel); |
| | | } |
| | | else |
| | | { |
| | | if (LevelManager.instanceExists) |
| | | { |
| | | LevelManager.instance.SetTowerAttID(gridPosition.x, attributeId, currentLevel); |
| | | LevelManager.instance.SetTowerAttID(gridPosition.x, ElfId, currentLevel); |
| | | WaveLineSelMgr.instance.attackTowerFixed(gridPosition.x); |
| | | } |
| | | else if (EndlessLevelManager.instanceExists) |
| | | { |
| | | EndlessLevelManager.instance.SetTowerAttID(gridPosition.x, attributeId, currentLevel); |
| | | EndlessLevelManager.instance.SetTowerAttID(gridPosition.x, ElfId, currentLevel); |
| | | EndlessWaveLineManager.instance.AttackTowerFixed(gridPosition.x, PlayWaveLineFlash); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// This function is called when the object becomes enabled and active. |
| | | /// </summary> |
| | | void OnEnable() |
| | | { |
| | | |
| | | // if (bulletCtl != null) |
| | | // { |
| | | // Debug.Log("打开了bulletCtl"); |
| | | // bulletCtl.gameObject.SetActive(true); |
| | | // } |
| | | |
| | | |
| | | // if (energyCtl != null) |
| | | // { |
| | | // Debug.Log("打开了energyCtl"); |
| | | // energyCtl.gameObject.SetActive(true); |
| | | // } |
| | | } |
| | | |
| | | public void CheckCtrl() |
| | | { |
| | | if (bulletCtl != null) |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化当前塔防的局内升级,lvl从1开始. |
| | | /// </summary> |
| | | /// <param name="lvl"></param> |
| | | public void initInSceneTowerLevel(int lvl) |
| | | { |
| | | inSceneTowerLevel = lvl; |
| | | if (lvl <= 1) |
| | | { |
| | | ResetInSceneTowerLevel(); |
| | | return; |
| | | } |
| | | // 设置攻击数据的加强,暂时是测试数据,后面需要读取表格数据处理: |
| | | float damageAdd = 0; |
| | | // float damageAdd = (inSceneTowerLevel - 1) * INSCENE_TU_DAMAGE; |
| | | for (int ti = 0; ti < levels.Length; ti++) |
| | | { |
| | | if (levels[ti].levelDamager) |
| | | { |
| | | levels[ti].levelDamager.doubleHit = bDoubleHitElit; |
| | | levels[ti].levelDamager.inSceneUpGradeDamage = damageAdd; |
| | | } |
| | | } |
| | | } |
| | | |
| | | protected void ResetInSceneTowerLevel() |
| | | { |
| | | for (int ti = 0; ti < levels.Length; ti++) |
| | | { |
| | | if (levels[ti].levelDamager) |
| | | { |
| | | levels[ti].levelDamager.inSceneUpGradeDamage = 0; |
| | | levels[ti].levelDamager.doubleHit = bDoubleHitElit; |
| | | } |
| | | } |
| | | return; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 升级当前塔防的局内等级,需要播放相关的特效 |
| | | /// </summary> |
| | | public void upGradeInSceneTL() |
| | | { |
| | | inSceneTowerLevel++; |
| | | |
| | | // 设置攻击数据的加强,暂时是测试数据,后面需要读取表格数据处理: |
| | | float damageAdd = inSceneTowerLevel * INSCENE_TU_DAMAGE; |
| | | |
| | | for (int ti = 0; ti < levels.Length; ti++) |
| | | { |
| | | if (levels[ti].levelDamager) |
| | | { |
| | | levels[ti].levelDamager.inSceneUpGradeDamage = damageAdd; |
| | | levels[ti].levelDamager.towerName = name; |
| | | levels[ti].levelDamager.bSet = true; |
| | | } |
| | | } |
| | | |
| | | Debug.Log("Upgrade Tower name is:" + name); |
| | | |
| | | // 播放相关的特效 |
| | | currentTowerLevel.PlayUpGradeEffect(); |
| | | CurrentTowerLevel.PlayUpGradeEffect(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public TowerPlacementGhost towerGhostPrefab |
| | | { |
| | | get { return levels[currentLevel].towerGhostPrefab; } |
| | | get { return towerLevel.towerGhostPrefab; } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public IPlacementArea placementArea { get; private set; } |
| | | |
| | | /// <summary> |
| | | /// The purchase cost of the tower |
| | | /// </summary> |
| | | public int purchaseCost |
| | | { |
| | | get { return levels[0].cost; } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// The event that fires off when a player deletes a tower |
| | | /// </summary> |
| | | public Action towerDeleted; |
| | |
| | | /// The event that fires off when a tower has been destroyed |
| | | /// </summary> |
| | | public Action towerDestroyed; |
| | | |
| | | /// <summary> |
| | | /// 放置到目标位置 |
| | | /// </summary> |
| | | /// <param name="destination"></param> |
| | | public virtual void SetToDestination(IntVector2 destination) |
| | | { |
| | | gridPosition = destination; |
| | | transform.position = placementArea.GridToWorld(destination, dimensions); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Provide the tower with data to initialize with |
| | |
| | | } |
| | | |
| | | SetLevel(lvl); |
| | | |
| | | if (LevelManager.instanceExists) |
| | | { |
| | | LevelManager.instance.levelStateChanged += OnLevelStateChanged; |
| | | } |
| | | else if (EndlessLevelManager.instanceExists) |
| | | EndlessLevelManager.instance.LevelStateChanged += OnLevelStateChanged; |
| | | |
| | | // 查找Targetter: |
| | | Targetter target = GetComponentInChildren<Targetter>(); |
| | | if (target) |
| | | { |
| | | target.bOpponent = opponentSide; |
| | | } |
| | | else |
| | | Debug.Log("在当前的Tower中找不到Targetter."); |
| | | |
| | | // |
| | | // 初始化当前的局内Tower等级数据 |
| | | initInSceneTowerLevel(SceneTowerLvl.getInSceneTowerLvl(towerName)); |
| | | |
| | | StartCoroutine(ResetScale()); |
| | | } |
| | | |
| | | IEnumerator ResetScale() |
| | | { |
| | | yield return new WaitForSeconds(0.2f); |
| | | if (gridPosition.y > 1) |
| | | { |
| | | currentTowerLevel.ResetScale(); |
| | | } |
| | | else |
| | | { |
| | | currentTowerLevel.NormalScale(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Provides information on the cost to upgrade |
| | | /// </summary> |
| | | /// <returns>Returns -1 if the towers is already at max level, other returns the cost to upgrade</returns> |
| | | public int GetCostForNextLevel() |
| | | { |
| | | if (isAtMaxLevel) |
| | | { |
| | | return -1; |
| | | } |
| | | return levels[currentLevel + 1].cost; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Provides the value recived for selling this tower |
| | | /// </summary> |
| | | /// <returns>A sell value of the tower</returns> |
| | | public int GetSellLevel() |
| | | { |
| | | return GetSellLevel(currentLevel); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Provides the value recived for selling this tower of a particular level |
| | | /// </summary> |
| | | /// <param name="level">Level of tower</param> |
| | | /// <returns>A sell value of the tower</returns> |
| | | public int GetSellLevel(int level) |
| | | { |
| | | // sell for full price if waves haven't started yet |
| | | if (LevelManager.instanceExists && LevelManager.instance.levelState == LevelState.Building |
| | | || EndlessLevelManager.instanceExists && EndlessLevelManager.instance.EndlessLeveltate == LevelState.Building) |
| | | { |
| | | int cost = 0; |
| | | for (int i = 0; i <= level; i++) |
| | | { |
| | | cost += levels[i].cost; |
| | | } |
| | | |
| | | return cost; |
| | | } |
| | | return levels[currentLevel].sell; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Used to (try to) upgrade the tower data |
| | | /// </summary> |
| | | public virtual bool UpgradeTower() |
| | | { |
| | | if (isAtMaxLevel) |
| | | if (IsMaxLevel) |
| | | { |
| | | return false; |
| | | } |
| | |
| | | /// </returns> |
| | | public virtual bool UpgradeTowerToLevel(int level) |
| | | { |
| | | if (level < 0 || isAtMaxLevel || level >= levels.Length) |
| | | { |
| | | return false; |
| | | } |
| | | if (level < 0 || IsMaxLevel || level >= ElfUpgradeData.MaxTowerLevel) return false; |
| | | |
| | | SetLevel(level); |
| | | return true; |
| | | } |
| | |
| | | public override void Remove() |
| | | { |
| | | base.Remove(); |
| | | |
| | | // 清空局内升级数据: |
| | | ResetInSceneTowerLevel(); |
| | | attackRise = 0.0f; |
| | | placementArea.Clear(gridPosition, dimensions); |
| | | Destroy(gameObject); |
| | |
| | | /// <summary> |
| | | /// Cache and update oftenly used data |
| | | /// </summary> |
| | | public void SetLevel(int level) |
| | | protected void SetLevel(int level) |
| | | { |
| | | if (level < 0 || level >= levels.Length) |
| | | { |
| | | return; |
| | | } |
| | | if (level < 0 || level >= ElfUpgradeData.MaxTowerLevel) return; |
| | | |
| | | currentLevel = level; |
| | | if (currentTowerLevel != null) |
| | | { |
| | | Destroy(currentTowerLevel.gameObject); |
| | | } |
| | | |
| | | // instantiate the visual representation |
| | | currentTowerLevel = Instantiate(levels[currentLevel], transform); |
| | | if (CurrentTowerLevel != null) |
| | | Destroy(CurrentTowerLevel.gameObject); |
| | | |
| | | // initialize TowerLevel |
| | | currentTowerLevel.Initialize(this, enemyLayerMask, configuration.alignmentProvider); |
| | | CurrentTowerLevel = Instantiate(towerLevel, transform); |
| | | CurrentTowerLevel.Initialize(this, enemyLayerMask, configuration.alignmentProvider); |
| | | CurrentTowerLevel.SetShowLevel(level + 1); |
| | | |
| | | // health data |
| | | ScaleHealth(); |
| | | |
| | | // |
| | | // disable affectors |
| | | LevelState levelState = LevelState.Intro; |
| | | if (LevelManager.instanceExists) |
| | |
| | | levelState = EndlessLevelManager.instance.EndlessLeveltate; |
| | | bool initialise = levelState == LevelState.AllEnemiesSpawned || levelState == LevelState.SpawningEnemies; |
| | | initialise = false; |
| | | currentTowerLevel.SetAffectorState(initialise, gridPosition.x); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Scales the health based on the previous health |
| | | /// Requires override when the rules for scaling health on upgrade changes |
| | | /// </summary> |
| | | protected virtual void ScaleHealth() |
| | | { |
| | | configuration.SetMaxHealth(currentTowerLevel.maxHealth); |
| | | |
| | | if (currentLevel == 0) |
| | | { |
| | | configuration.SetHealth(currentTowerLevel.maxHealth); |
| | | } |
| | | else |
| | | { |
| | | int currentHealth = Mathf.FloorToInt(configuration.normalisedHealth * currentTowerLevel.maxHealth); |
| | | configuration.SetHealth(currentHealth); |
| | | } |
| | | CurrentTowerLevel.SetAffectorState(initialise, gridPosition.x); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | bool initialise = current == LevelState.AllEnemiesSpawned || current == LevelState.SpawningEnemies; |
| | | initialise = false; |
| | | //currentTowerLevel.SetAffectorState(initialise); |
| | | currentTowerLevel.SetAffectorState(bInAttackMode, gridPosition.x); |
| | | CurrentTowerLevel.SetAffectorState(bInAttackMode, gridPosition.x); |
| | | } |
| | | } |
| | | } |