From e36f2a3ac098d6e89d3882f3354ec69c07e71e16 Mon Sep 17 00:00:00 2001 From: chenxin <chenxin6991@163.com> Date: Tue, 01 Dec 2020 15:55:40 +0800 Subject: [PATCH] 代码结构修改 --- Assets/Scripts/ActionGameFramework/Health/Targetable.cs | 179 ----------------------------------------------------------- 1 files changed, 0 insertions(+), 179 deletions(-) diff --git a/Assets/Scripts/ActionGameFramework/Health/Targetable.cs b/Assets/Scripts/ActionGameFramework/Health/Targetable.cs index 1b3292d..40c196f 100644 --- a/Assets/Scripts/ActionGameFramework/Health/Targetable.cs +++ b/Assets/Scripts/ActionGameFramework/Health/Targetable.cs @@ -1,7 +1,4 @@ using Core.Health; -using System; -using System.Dynamic; -using TowerDefense.UI.HUD; using UnityEngine; namespace ActionGameFramework.Health @@ -17,85 +14,9 @@ public Transform targetTransform; /// <summary> - /// 是否精英怪 - /// </summary> - public bool bElit = false; - - /// <summary> - /// 是否Boss怪. - /// </summary> - public bool bBoss = false; - - /// <summary> - /// 分别对应三种不同的纹理. - /// </summary> - public Texture poisonTex; - public Texture frozenTex; - public Texture commonTex; - - /// <summary> /// The position of the object /// </summary> protected Vector3 m_CurrentPosition, m_PreviousPosition; - - - /// <summary> - /// 速度降低值. - /// </summary> - protected float speedSlowRate = 0.0f; - - // 中毒相关的数据 - protected int poisonTimes = 0; - protected float poisonHurt = 0.0f; - protected int poisonAttid = 0; - protected float timeToPoisonHurt = 0.0f; - - /// <summary> - /// 是否处于 中毒状态 - /// </summary> - protected bool isPoison; - - /// <summary> - /// 是否处于减速状态 - /// </summary> - protected bool isSlowDown; - - /// <summary> - /// 是否处于冰冻状态 - /// </summary> - protected bool isFrost; - - /// <summary> - /// 中毒粒子特效 - /// </summary> - public ParticleSystem PoisonParticle; - - /// <summary> - /// 中毒结束播放的粒子特效 - /// </summary> - public ParticleSystem PoisonEndParticle; - - /// <summary> - /// 减速粒子特效 - /// </summary> - public ParticleSystem SlowDownParticle; - - /// <summary> - /// 冰冻特效 - /// </summary> - public ParticleSystem FrostParticle; - - /// <summary> - /// 被火技能攻击特效 - /// </summary> - public ParticleSystem FireSkillParticle; - - protected Color mMatColor; - - /// <summary> - /// 是否处于破甲状态. - /// </summary> - public bool bShieldBreak { get; set; } /// <summary> /// The velocity of the rigidbody @@ -117,104 +38,6 @@ return targetTransform == null ? transform : targetTransform; } } - - /// <summary> - /// 设置当前目标的颜色数据 - /// </summary> - /// <param name="color"></param> - public void SetTargetableMatColor(Color color, bool force = false) - { - - if (!force) - { - if (color == mMatColor) return; - // 无敌状态,只接受白色原贴图: - if (this.configuration.bInvincible && (color != Color.white)) return; - } - - foreach (Transform t in transform.GetComponentsInChildren<Transform>()) - { - if (t.name == "Cube") - { - Material tMat = t.GetComponent<MeshRenderer>().material; - if ((color == Color.green) && (poisonTex != null)) - { - tMat.mainTexture = poisonTex; - } - if ((color == Color.blue) && (frozenTex != null)) - { - tMat.mainTexture = frozenTex; - } - if ((color == Color.white) && (commonTex != null)) - { - tMat.mainTexture = commonTex; - } - mMatColor = color; - } - - } - } - - - /// <summary> - /// 降低移动速度. - /// </summary> - /// <param name="rate"></param> - public void addSpeedSlowRate(float rate) - { - speedSlowRate += rate; - if (speedSlowRate >= 0.5f) - speedSlowRate = 0.5f; - } - - /// <summary> - /// 怪物中毒. - /// </summary> - /// <param name="damage"></param> - public void poisonAgent(float damage, int attid) - { - if (this.poisonTimes >= 1) return; - - if (!isPoison) - { - isPoison = true; - - if (PoisonParticle != null) - PoisonParticle.Play(); - } - - this.poisonTimes++; - this.poisonAttid = attid; - this.poisonHurt = (float)Math.Floor(this.configuration.maxHealth / 20.0f); - this.timeToPoisonHurt = 1.0f; - } - - public bool bInPoison { get { return this.poisonHurt > 0; } } - - /// <summary> - /// 处理中毒相关的数据 - /// </summary> - /// <param name="time"></param> - protected void updatePoison(float time) - { - this.timeToPoisonHurt -= time; - if (this.timeToPoisonHurt <= 0) - { - Vector3 backPos = this.transform.position; - this.TakeDamage(poisonHurt, this.transform.position, null, poisonAttid); - if ((poisonHurt > 0) && (!opponentAgent)) - { - if (GameUI.instanceExists) - GameUI.instance.generateBloodText(backPos, poisonHurt, false, false, true); - else if (EndlessGameUI.instanceExists) - EndlessGameUI.instance.generateBloodText(backPos, poisonHurt, false, false, true); - } - - if (poisonHurt > 0) - timeToPoisonHurt = 1.0f; - } - } - /// <summary> /// Returns our targetable's transform position @@ -244,8 +67,6 @@ { base.Awake(); ResetPositionData(); - bShieldBreak = false; - mMatColor = Color.white; } /// <summary> -- Gitblit v1.9.1