From 9ba26d8f5c0103d9f6bbc15ec76dde8ec935979b Mon Sep 17 00:00:00 2001 From: River Jiang <546213258@qq.com> Date: Thu, 22 Oct 2020 11:08:43 +0800 Subject: [PATCH] 加入对向的玉米动画 --- Assets/Scripts/TowerDefense/Towers/Tower.cs | 63 +++++++++++++++++++++---------- 1 files changed, 43 insertions(+), 20 deletions(-) diff --git a/Assets/Scripts/TowerDefense/Towers/Tower.cs b/Assets/Scripts/TowerDefense/Towers/Tower.cs index 4aa7604..576c515 100644 --- a/Assets/Scripts/TowerDefense/Towers/Tower.cs +++ b/Assets/Scripts/TowerDefense/Towers/Tower.cs @@ -62,6 +62,8 @@ /// </summary> public Material materialTowerAttackSelf; public Material materialTowerWaitSelf; + public Material materialTowerAttackOppo; + public Material materialTowerWaitOppo; /// <summary> /// 0 空状态 1 等待状态 2 攻击状态. @@ -137,16 +139,33 @@ { if (!materialTowerAttackSelf) return; - if (attack && (this.curActionState != 2)) + if( opponentSide) { - currentTowerLevel.SetTowerMonsterMat(materialTowerAttackSelf); - this.curActionState = 2; - } + if (attack && (this.curActionState != 2)) + { + currentTowerLevel.SetTowerMonsterMat(materialTowerAttackOppo); + this.curActionState = 2; + } - if ((!attack) && (this.curActionState != 1)) + if ((!attack) && (this.curActionState != 1)) + { + currentTowerLevel.SetTowerMonsterMat( materialTowerWaitOppo ); + this.curActionState = 1; + } + } + else { - currentTowerLevel.SetTowerMonsterMat(materialTowerWaitSelf); - this.curActionState = 1; + if (attack && (this.curActionState != 2)) + { + currentTowerLevel.SetTowerMonsterMat(materialTowerAttackSelf); + this.curActionState = 2; + } + + if ((!attack) && (this.curActionState != 1)) + { + currentTowerLevel.SetTowerMonsterMat(materialTowerWaitSelf); + this.curActionState = 1; + } } } @@ -172,11 +191,11 @@ if (opponentSide) currentTowerLevel.SetTowerMonsterMat(materialMonsterOppo); else - { currentTowerLevel.SetTowerMonsterMat(materialMonsterSelf); - this.setTowerState(false); - } - + + // 处理Tower + this.setTowerState(false); + if (opponentSide) { @@ -198,17 +217,21 @@ // // 根据是否是子弹塔防来决定是否显示相应的界面 - if (this.eTowerFuntion == ETowerFuntion.BULLET) + BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x); + /* + if ( (this.eTowerFuntion == ETowerFuntion.BULLET) && (buc != null ) ) { - BulletUICtl buc = this.placementArea.GetBulletUICtl(gridPosition.x); - /* - if (buc) - { - buc.gameObject.SetActive(true); - this.bulletCtl = buc; - buc.resetToMaxBullet(); - }*/ + // 设置数据 + buc.gameObject.SetActive(true); + this.bulletCtl = buc; + buc.resetToMaxBullet(); } + else + { + // 清空数据 + buc.gameObject.SetActive(false); + this.bulletCtl = null; + }*/ } } -- Gitblit v1.9.1