From 16072ec5c78cf2f183ef5cbdddeb34416225a9ea Mon Sep 17 00:00:00 2001 From: River Jiang <546213258@qq.com> Date: Wed, 21 Oct 2020 15:07:55 +0800 Subject: [PATCH] 加入玉米动画 --- Assets/Scripts/TowerDefense/Towers/Tower.cs | 39 ++++++++++++++++++++++++++++++++++++++- 1 files changed, 38 insertions(+), 1 deletions(-) diff --git a/Assets/Scripts/TowerDefense/Towers/Tower.cs b/Assets/Scripts/TowerDefense/Towers/Tower.cs index 9b7d72b..d354c9a 100644 --- a/Assets/Scripts/TowerDefense/Towers/Tower.cs +++ b/Assets/Scripts/TowerDefense/Towers/Tower.cs @@ -58,9 +58,21 @@ public Material materialMonsterOppo; /// <summary> + /// 当前塔防对应的攻击和等待Mat. + /// </summary> + public Material materialTowerAttackSelf; + public Material materialTowerWaitSelf; + + /// <summary> + /// 0 空状态 1 等待状态 2 攻击状态. + /// </summary> + protected int curActionState = 0; + + /// <summary> /// 塔防对应的充能状态. /// </summary> public ETowerFuntion eTowerFuntion = ETowerFuntion.NULL; + public BulletUICtl bulletCtl = null; /// <summary> /// The tower levels associated with this tower @@ -120,6 +132,23 @@ get { return currentLevel == levels.Length - 1; } } + public void setTowerState(bool attack) + { + if (!materialTowerAttackSelf) return; + + if (attack && (this.curActionState != 2)) + { + currentTowerLevel.SetTowerMonsterMat(materialTowerAttackSelf); + this.curActionState = 2; + } + + if ((!attack) && (this.curActionState != 1)) + { + currentTowerLevel.SetTowerMonsterMat(materialTowerWaitSelf); + this.curActionState = 1; + } + } + /// <summary> /// 是否是对手塔防 /// </summary> @@ -142,7 +171,11 @@ if (opponentSide) currentTowerLevel.SetTowerMonsterMat(materialMonsterOppo); else + { currentTowerLevel.SetTowerMonsterMat(materialMonsterSelf); + this.setTowerState(false); + } + if (opponentSide) { @@ -163,12 +196,16 @@ } // - // 根据是否是子弹塔防来决定是否显示相应的界面.WORK START: 处理出来下一步的子弹减少和对应的充子弹时间. + // 根据是否是子弹塔防来决定是否显示相应的界面 if (this.eTowerFuntion == ETowerFuntion.BULLET) { BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x); if (buc) + { buc.gameObject.SetActive(true); + this.bulletCtl = buc; + buc.resetToMaxBullet(); + } } } -- Gitblit v1.9.1