using System.Collections; using System.Collections.Generic; using UnityEngine; using System; using UnityEngine.UI; using UnityEngine.AI; using Cinemachine; using BehaviorDesigner.Runtime; using UnityGameFramework.Runtime; using Chronos; using AdonGameKit; using Adon.Game.BO; /// /// 角色类 /// public class Role : RoleBase { /// /// 动画控制器 /// public Animator mAnimator = null; public Animator mBattleCameraAnim = null; public int cameraState = 0; public bool cameraLock = false; public string playerUID = ""; /// /// 攻击中 /// public bool attacking = false; /// /// 行为树 /// public BehaviorTree mBehaviorTree = null; /// /// 寻路插件(配合行为树插件使用) /// public NavMeshAgent mNavMeshAgent = null; /// /// 寻路插件(配合行为树插件使用) /// public CharacterController mCharacterController = null; /// /// 动作帧事件 /// public AnimationSkillEvent mSkillEvent = null; /// /// 阵营 /// public E_Camp Camp = E_Camp.None; /// /// 移动方向 /// private Vector3 mMoveDir = Vector3.zero; /// /// 蒙皮SkinnedMeshRenderer /// private SkinnedMeshRenderer[] mSkinnedMeshRenderers = null; /// /// 开火点 /// public FirePos[] mFirePoss = null; /// /// 打击点 /// public HitPos mHitPos = null; /// /// 是否是队长 /// public bool IsTeamLeader = false; /// /// 是否是英雄 /// public bool IsHero = false; /// /// 角色类型 /// public RoleType roleType; /// /// 是否是最后一个点 /// public bool IsEndPoint = false; /// /// 出生区域 /// public int mLiveArea = -1; /// /// 是否无敌 /// public bool mInvincible = false; /// /// 出生坐标 /// public Vector3 mLivePos; public List dropId = null; /// /// 活动范围 /// public float mRadius = 0; /// /// 资源名称 /// public string mResName = ""; /// /// 能量更新计时器 /// private float addSPTime = 0; private Dictionary _buffEffctList; public YLBattle.SpawnPoint.BubbleType bubType; public string bubStr; public bool bubEnable = false; public int spawnerID = 0; private GameObject mTipArrowObj = null; private List mCreateTipArrows = new List(); /// /// 碰撞 /// public CapsuleCollider mCollider = null; /// /// /// 是否是镜像 /// public bool isMirror = false; /// /// 时钟组件 /// public Timeline time { get { return GetComponent(); } } /// /// 初始化 /// /// 数据 /// 阵营 /// 是否是镜像 public void Init(YLBattleUnit date, E_Camp camp = E_Camp.Red, bool _isMirror = false) { base.Init(date); selfTransform = transform; Camp = camp; if (Camp == E_Camp.Red) { gameObject.layer = LayerMask.NameToLayer("Enemy"); this.transform.Find("MiniMapFlagEnemy").gameObject.SetActive(false); } else { gameObject.layer = LayerMask.NameToLayer("Player"); this.transform.Find("MiniMapFlagSelf").gameObject.SetActive(false); } isMirror = _isMirror; mBehaviorTree = transform.GetComponent(); mNavMeshAgent = transform.GetComponent(); mCollider = transform.GetComponent(); mCharacterController = transform.GetComponent(); mSkillEvent = transform.GetComponentInChildren(); mAnimator = mSkillEvent.transform.GetComponent(); Transform btCA = this.transform.Find("CMStateDrivenCamera"); if (btCA) { mBattleCameraAnim = btCA.GetComponent(); } mSkinnedMeshRenderers = transform.GetComponentsInChildren(); mFirePoss = transform.GetComponentsInChildren(true); mHitPos = transform.GetComponentInChildren(true); this._buffEffctList = new Dictionary(); ////// 显示攻击特效 ////mSkillEvent.mSlowTimeStart = OnSlowTimeStart; ////mSkillEvent.mSlowTimeEnd = OnSlowTimeEnd; // 英雄 if (date.mIsHero) { //GameObject cm = this.gameObject.transform.Find("CMStateDrivenCamera").gameObject; //if (cm) //{ // cm.SetActive(false); //} // 武器换装 if (this.mData.mHeroVo.equips.ContainsKey("weapon") && this.mData.mHeroVo.equips["weapon"].EquipMo() != null) { string weaponName = this.mData.mHeroVo.equips["weapon"].EquipMo().res; WeaponPos[] weapons = this.transform.GetComponentsInChildren(true); foreach (var item in weapons) { if (String.Equals(item.gameObject.name, weaponName, StringComparison.CurrentCultureIgnoreCase))///按刘海的要求,改动一下,刘海要求从typeid适配武器模型,改为从res来适配武器模型。 // if (item.gameObject.name == weaponName) { item.gameObject.SetActive(true); } else { item.gameObject.SetActive(false); } } } } } public void Update() { } /// /// 设置移动速度 /// /// public void SetMoveSpeed(float speed) { if (mBehaviorTree) { mBehaviorTree.SetVariableValue("moveSpeed", speed); } } public void RefreshYanLing(int pos, HeroGameVo_Yanling yanlingVO) { if (yanlingVO != null) { // 骨骼挂载点 挂载言灵装饰预制体 Transform tsfmHero = transform; Transform tsfmPoint; YanLingBonePoint[] points = tsfmHero.GetComponentsInChildren(true); foreach (var item in points) { if (item._bonePointType != (YanLingBonePoint.BonePoint)pos) { continue; } if (yanlingVO.itemuid == 0) { // item.gameObject.SetActive(false); return; } item.gameObject.SetActive(true); int childCount = item.transform.childCount; if (childCount > 0) { var children = new List(); for (int i = 0; i < childCount; ++i) { var child = item.transform.GetChild(i).gameObject; children.Add(child); } for (int i = 0; i < childCount; ++i) { var child = children[i]; #if UNITY_EDITOR UnityEngine.Object.DestroyImmediate(child); #else UnityEngine. Object.Destroy(child); #endif } } string ylRes = yanlingVO.Mo().GetYanlingExt().res; ResourceHelper.Instance.LoadAssetBundle(ylRes, (bundle) => { if (bundle != null) { GameObject obj = (GameObject)Instantiate(bundle.LoadAsset(ylRes), item.transform); if (obj) { obj.transform.parent = item.transform; obj.transform.localPosition = Vector3.zero; } } }); } } } public void NetMoveSC(float x, float y, float z) { this.transform.position.Set(x, y, z); } public static GameObject FindHideChildGameObject(GameObject parent, string childName) { if (parent.name == childName) { return parent; } if (parent.transform.childCount < 1) { return null; } GameObject obj = null; for (int i = 0; i < parent.transform.childCount; i++) { GameObject go = parent.transform.GetChild(i).gameObject; obj = FindHideChildGameObject(go, childName); if (obj != null) { break; } } return obj; } /////// /////// 技能发射事件 /////// ////private void OnSlowTimeStart() ////{ //// RPGPlayerController.Instance.OnSlowTimeStart(this); ////} /////// /////// 技能发射事件 /////// ////private void OnSlowTimeEnd() ////{ //// RPGPlayerController.Instance.OnSlowTimeEnd(this); ////} /// /// 播放动画 /// /// 动作名称 /// 淡入时间 public void PlayAnimation(string aniName, float crossTime = 0) { if (mAnimator == null) { return; } if (crossTime < 0.01f) { mAnimator.Play(aniName, 0, 0); } else { mAnimator.CrossFade(aniName, crossTime); } } /// /// 某段动画是否播放完成 /// /// 动画名称 /// 播放的进度(大于1.0f表示播放完成) /// 状态 public bool IsPlayAnimationOver(string aniName, float playProgress = 1.0f) { if (mAnimator == null) { return true; } // 获取动画层 0 指Base Layer. AnimatorStateInfo stateinfo = mAnimator.GetCurrentAnimatorStateInfo(0); if (stateinfo.IsName(aniName)) { if (stateinfo.loop) { return false; } else { if (stateinfo.normalizedTime >= playProgress) { return true; } else { return false; } } } return true; } ///// ///// 获取动画时长 ///// ///// 片段名称 ///// //public float GetAnimationClipLength(string clip) //{ // if (null == mAnimator || string.IsNullOrEmpty(clip) || null == mAnimator.runtimeAnimatorController) // { // return 0; // } // RuntimeAnimatorController ac = mAnimator.runtimeAnimatorController; // AnimationClip[] tAnimationClips = ac.animationClips; // if (null == tAnimationClips || tAnimationClips.Length <= 0) // { // return 0; // } // AnimationClip tAnimationClip; // for (int i = 0; i < tAnimationClips.Length; i++) // { // tAnimationClip = tAnimationClips[i]; // if (null != tAnimationClip && tAnimationClip.name == clip) // { // return tAnimationClip.length; // } // } // return 0; //} /// /// 颜色抖动 /// public void ShakeColor(bool heroShake = false) { // 英雄不变色 if (heroShake == false && mData.mIsHero) { return; } BeAttackFlash flash = gameObject.GetComponent(); if (flash == null) { flash = gameObject.AddComponent(); } flash.Flash(); } /// /// 旋转 /// /// public void SetRotation(Vector3 dir) { Quaternion quaDir = Quaternion.LookRotation(dir, Vector3.up); Vector3 angle = quaDir.eulerAngles; angle.x = 0; quaDir.eulerAngles = angle; // 方向不同才需转向 if (quaDir != selfTransform.rotation) { StartCoroutine(IE_Rotationing(quaDir)); } } /// /// 协同旋转 /// /// 方向 /// 迭代器 private IEnumerator IE_Rotationing(Quaternion quaDir) { float val = 0; while (val < 1.0f) { val += Time.deltaTime * 5; selfTransform.rotation = Quaternion.Lerp(selfTransform.rotation, quaDir, val); yield return null; } } private bool bTip = false; /// /// 更新血条 /// /// public void UpdateHP(float val, bool isCrit = false) { //HpbarManager.Instance.CreateHpTip(this, (int)val, isCrit); if (!(val > 0 || val < 0)) { return; } // 队长 if (IsTeamLeader) { GameDateManager.Instance.PlayerBehitCount++; BattleCanvas.Instance.ShowPlayerHP(mData.HP_Final, mData.MaxHP_Final); //HpbarManager.Instance.UpdateHpbar(this, mData.HP_Final / (float)mData.MaxHP_Final, (int)val); if (mData.HP_Final / (float)mData.MaxHP_Final < 0.3f) { ConvertEffect.Instance.PlayEffect(ConvertEffect.convertEffectType.Dying, null); } else { ConvertEffect.Instance.PlayEffect(ConvertEffect.convertEffectType.Default, null); } //BattleCanvas.Instance.ShowPlayerPower(mData.MP_Final, mData.MaxMP_Final); } // 队员 else if (mData.mIsHero && IsTeamLeader == false) { GameDateManager.Instance.PlayerBehitCount++; HpbarManager.Instance.UpdateHpbar(this, mData.HP_Final / (float)mData.MaxHP_Final, (int)val); } // 怪物 else if (mData.mIsHero == false) { GameDateManager.Instance.PlayerComboCount++; if (BattleCanvas.Instance) { BattleCanvas.Instance.UpdateComboNumber(); } if (isDie) { this.mBehaviorTree.SendEvent("DieEvent"); } // 更新已经锁定的目标血条 if (HeroPlayerController.Instance.m_Hero.TargetRole == this) { if (isDie) { BattleCanvas.Instance.HideLockMonsterHP(); } else { BattleCanvas.Instance.ShowLockMonsterHP(this); } } HpbarManager.Instance.UpdateHpbar(this, mData.HP_Final / (float)mData.MaxHP_Final, (int)val); } if (val > 0) { ResourceHelper.Instance.LoadAssetBundle("zhandou_jiaxue_tishi", (AssetBundle bundle) => { if (null != bundle) { GameObject jiaxue = Instantiate(bundle.LoadAsset("zhandou_jiaxue_tishi")); jiaxue.transform.parent = this.transform; jiaxue.transform.localPosition = Vector3.zero; CmptAutoDestory cmpt = jiaxue.AddComponent(); cmpt.LiveTime = 2.0f; } }); } // 收到伤害颜色渐变 //if (val < 0) //{ // ShakeColor(); //} } /// /// 0 自己 1 父节点 /// /// /// /// /// public void AddEffect(int addType, Transform effectObj, X2Battle.EBulletCastPoint castType, BattleDefine.Skill_LaunchPos skillPos = BattleDefine.Skill_LaunchPos.Chest) { Transform node = null; if (castType == X2Battle.EBulletCastPoint.ECAST_POINT_DEFLUAT) { switch (skillPos) { case BattleDefine.Skill_LaunchPos.Chest: if (mData.mIsHero) { node = mAnimator.transform.Find("Effect_000/Hit"); } else { node = mAnimator.transform.Find("Effect_000/Hit"); } break; case BattleDefine.Skill_LaunchPos.Head: node = mAnimator.transform.Find("Effect_000/Top"); break; case BattleDefine.Skill_LaunchPos.Hand: node = mAnimator.transform.Find("Effect_000/Hit"); break; case BattleDefine.Skill_LaunchPos.Foot: node = mAnimator.transform.Find("Effect_000/Foot"); break; } } else { node = X2Battle.X2BattleManager.Instance.mBulletModel.GetPosBySkillType(this, castType); } if (node != null) { effectObj.position = node.position; effectObj.rotation = node.rotation; if (addType == 0) { effectObj.SetParent(mAnimator.transform.parent); } else if (addType == 1) { effectObj.SetParent(mAnimator.transform.parent.parent); } } } public Transform GetPointTrans(BattleDefine.Skill_LaunchPos pointType) { Transform node = null; switch (pointType) { case BattleDefine.Skill_LaunchPos.Chest: if (mData.mIsHero) { node = mAnimator.transform.Find("Effect_000/Hit"); } else { node = mAnimator.transform.Find("Effect_000/Hit"); } break; case BattleDefine.Skill_LaunchPos.Head: node = mAnimator.transform.Find("Effect_000/Top"); break; case BattleDefine.Skill_LaunchPos.Hand: node = mAnimator.transform.Find("Effect_000/Hit"); break; case BattleDefine.Skill_LaunchPos.Foot: node = mAnimator.transform.Find("Effect_000/Foot"); break; } return node; } public float GetPropertyBase(YLBattle.EBattleProperty perperty) { return 0; } public void AdditionBuffEffect(YLBattle.Buff buff) { return; if (this._buffEffctList.ContainsKey(buff.tid.ToString())) { return; } string buffPathName = "Battle/buff_" + buff.adapter.Res(); UnityEngine.Object buffObj = Resources.Load(buffPathName); if (buffObj) { Transform newBuffObj = (GameObject.Instantiate(buffObj) as GameObject).transform; newBuffObj.name = buffPathName; this._buffEffctList.Add(buff.tid.ToString(), newBuffObj.gameObject); sm_buff buffMo = sm_buff.GetMoByID(int.Parse(buff.tid)); AddEffect(0, newBuffObj, X2Battle.EBulletCastPoint.ECAST_POINT_DEFLUAT, (BattleDefine.Skill_LaunchPos)buffMo.bullet_attack_poi); } } public void RemoveBuffEffect(YLBattle.Buff buff) { return; if (this._buffEffctList.ContainsKey(buff.tid.ToString())) { GameObject.Destroy(this._buffEffctList[buff.tid.ToString()]); this._buffEffctList.Remove(buff.tid.ToString()); } } /// /// 执行一次Buff 属性修改 /// /// /// /// public void ModifyProperty(YLBattle.Buff buff, YLBattle.EBattleProperty property, int value) { this.SetPropertyFinal(buff, property, value); } /// /// 执行一次Buff 属性修改 /// /// /// /// public void ModifyProperty(YLBattle.Buff buff, YLBattle.EBattleProperty property, float value) { this.SetPropertyFinal(buff, property, value); } public float GetBattleProperty(YLBattle.EBattleProperty property) { return (float)this.GetPropertyFinal(property); } public int GetBuffEffectProperty(YLBattle.EBuffEffect property) { return 0; } public string ID() { return this.mData.UID.ToString(); } public float GetProperty(YLBattle.EBattleProperty property) { float value = 0; switch (property) { case YLBattle.EBattleProperty.YANLI: value = mData.YAN; break; case YLBattle.EBattleProperty.KANGBAOLI: value = mData.KBL; break; case YLBattle.EBattleProperty.ATTACK: value = mData.ATK; break; case YLBattle.EBattleProperty.ATTACKSPEED: value = mData.ASP; break; case YLBattle.EBattleProperty.MOVESPEED: value = mData.MSP; break; case YLBattle.EBattleProperty.COOLTIME: value = mData.CLT; break; case YLBattle.EBattleProperty.ATKRANGE: value = mData.ARG; break; case YLBattle.EBattleProperty.ALARMRANGE: value = mData.ORG; break; case YLBattle.EBattleProperty.CRITICALPROB: value = mData.CRT; break; // 暴击伤害 默认2倍 不做基础属性存储 case YLBattle.EBattleProperty.CRITICALDAMAGE: value = 2; break; case YLBattle.EBattleProperty.DEFENSE: value = mData.DEF; break; case YLBattle.EBattleProperty.HEIGHT: value = 2; break; case YLBattle.EBattleProperty.HP: value = mData.HP; break; case YLBattle.EBattleProperty.HPMAX: value = mData.MaxHP; break; case YLBattle.EBattleProperty.LEVEL: value = mData.LV; break; case YLBattle.EBattleProperty.MAGICFORCE: value = mData.MDF; break; case YLBattle.EBattleProperty.MAGICSTRENGTH: value = mData.ADM; break; case YLBattle.EBattleProperty.NMAXPOWER: value = 10; break; case YLBattle.EBattleProperty.NPOWER: value = 100; break; case YLBattle.EBattleProperty.POSX: value = this.transform.position.x; break; case YLBattle.EBattleProperty.POSY: value = this.transform.position.z; break; } return value; } public float GetPropertyFinal(YLBattle.EBattleProperty property) { float value = 0; switch (property) { case YLBattle.EBattleProperty.YANLI: value = mData.YAN_Final; break; case YLBattle.EBattleProperty.KANGBAOLI: value = mData.KBL_Final; break; case YLBattle.EBattleProperty.ATTACK: value = mData.ATK_Final; break; case YLBattle.EBattleProperty.ATTACKSPEED: value = mData.ASP_Final; break; case YLBattle.EBattleProperty.MOVESPEED: value = mData.MSP_Final; break; case YLBattle.EBattleProperty.COOLTIME: value = mData.CLT_Final; break; case YLBattle.EBattleProperty.ATKRANGE: value = mData.ARG_Final; break; case YLBattle.EBattleProperty.ALARMRANGE: value = mData.ORG_Final; break; case YLBattle.EBattleProperty.CRITICALPROB: value = mData.CRT_Final; break; case YLBattle.EBattleProperty.CRITICALDAMAGE: value = mData.CRD_Final; break; case YLBattle.EBattleProperty.DEFENSE: value = mData.DEF_Final; break; case YLBattle.EBattleProperty.HEIGHT: value = 2; break; case YLBattle.EBattleProperty.HP: value = mData.HP_Final; break; case YLBattle.EBattleProperty.HPMAX: value = mData.MaxHP_Final; break; case YLBattle.EBattleProperty.LEVEL: value = mData.LV; break; case YLBattle.EBattleProperty.MAGICFORCE: value = mData.MDF_Final; break; case YLBattle.EBattleProperty.MAGICSTRENGTH: value = mData.ADM_Final; break; case YLBattle.EBattleProperty.NMAXPOWER: value = mData.MaxMP_Final; break; case YLBattle.EBattleProperty.NPOWER: value = mData.MP_Final; break; case YLBattle.EBattleProperty.POSX: value = this.transform.position.x; break; case YLBattle.EBattleProperty.POSY: value = this.transform.position.z; break; } return value; } public void SetPropertyFinal(YLBattle.Buff buff, YLBattle.EBattleProperty property, float value) { switch (property) { case YLBattle.EBattleProperty.YANLI: mData.YAN_Final = (int)value; break; case YLBattle.EBattleProperty.KANGBAOLI: mData.KBL_Final = value; break; case YLBattle.EBattleProperty.ATTACK: mData.ATK_Final = (int)value; break; case YLBattle.EBattleProperty.ATTACKSPEED: mData.ASP_Final = value; // mAnimator.speed = mData.ASP_Final; break; case YLBattle.EBattleProperty.MOVESPEED: mData.MSP_Final = value; // SetMoveSpeed(mData.MSP_Final); break; case YLBattle.EBattleProperty.COOLTIME: mData.CLT_Final = value; break; case YLBattle.EBattleProperty.ATKRANGE: mData.ARG_Final = value; break; case YLBattle.EBattleProperty.ALARMRANGE: mData.ORG_Final = value; break; case YLBattle.EBattleProperty.CRITICALPROB: mData.CRT_Final = value; break; case YLBattle.EBattleProperty.CRITICALDAMAGE: mData.CRD_Final = value; break; case YLBattle.EBattleProperty.DEFENSE: mData.DEF_Final = (int)value; break; case YLBattle.EBattleProperty.HEIGHT: value = 2; break; case YLBattle.EBattleProperty.HP: mData.HP_Final = (int)value; break; case YLBattle.EBattleProperty.HPMAX: mData.MaxHP_Final = (int)value; break; case YLBattle.EBattleProperty.LEVEL: break; case YLBattle.EBattleProperty.MAGICFORCE: mData.MDF_Final = (int)value; break; case YLBattle.EBattleProperty.MAGICSTRENGTH: mData.ADM_Final = (int)value; break; case YLBattle.EBattleProperty.NMAXPOWER: mData.MaxMP_Final = (int)value; break; case YLBattle.EBattleProperty.NPOWER: mData.SetMP((int)value, true); break; case YLBattle.EBattleProperty.POSX: break; case YLBattle.EBattleProperty.POSY: break; } } public bool GetPropertyBuff(YLBattle.EBuffEffect eff) { int value = 0; switch (eff) { case YLBattle.EBuffEffect.EBUFF_EFFECT_Shield: value = this.mData.BUFF_SHI; break; case YLBattle.EBuffEffect.EBUFF_EFFECT_Silent: value = this.mData.BUFF_SIL; break; case YLBattle.EBuffEffect.EBUFF_EFFECT_Static: value = this.mData.BUFF_STA; break; case YLBattle.EBuffEffect.EBUFF_EFFECT_Stun: value = this.mData.BUFF_STU; break; case YLBattle.EBuffEffect.EBUFF_EFFECT_BUR: value = this.mData.BUFF_BUR; break; case YLBattle.EBuffEffect.EBUFF_EFFECT_ICE: value = this.mData.BUFF_ICE; break; case YLBattle.EBuffEffect.EBUFF_EFFECT_DIM: value = this.mData.BUFF_DIM; break; } return value > 0 ? true : false; } public void AddPropertyBuff(YLBattle.Buff buff, YLBattle.EBuffEffect eff) { sm_buff nowbuff = GameConfigData.Ins.GetbuffMo(int.Parse(buff.tid)); // 创建战报 Role cRole = buff.caster; Role tRole = buff.target; WarReport.WarReportInfo info = new WarReport.WarReportInfo(); WarReport.WarReportUnit ownerUnit = new WarReport.WarReportUnit(); WarReport.WarReportUnit targetUnit = new WarReport.WarReportUnit(); ownerUnit.InitData(cRole); targetUnit.InitData(tRole); info.UnitDataOwner.Add(ownerUnit); info.UnitDataTarget.Add(targetUnit); switch (eff) { case YLBattle.EBuffEffect.EBUFF_EFFECT_Shield: targetUnit.OriginData.BUFF_SHI = this.mData.BUFF_SHI; this.mData.BUFF_SHI += 1; targetUnit.NowData.BUFF_SHI = this.mData.BUFF_SHI; targetUnit.DiffData.BUFF_SHI = 1; break; case YLBattle.EBuffEffect.EBUFF_EFFECT_Silent: targetUnit.OriginData.BUFF_SIL = this.mData.BUFF_SIL; this.mData.BUFF_SIL += 1; targetUnit.NowData.BUFF_SIL = this.mData.BUFF_SIL; targetUnit.DiffData.BUFF_SIL = 1; this.BuffStopAttack(); break; case YLBattle.EBuffEffect.EBUFF_EFFECT_Static: targetUnit.OriginData.BUFF_STA = this.mData.BUFF_STA; this.mData.BUFF_STA += 1; targetUnit.NowData.BUFF_STA = this.mData.BUFF_STA; targetUnit.DiffData.BUFF_STA = 1; this.BuffStopAnimation(); this.BuffStopMove(); this.BuffStopAttack(); break; case YLBattle.EBuffEffect.EBUFF_EFFECT_Stun: targetUnit.OriginData.BUFF_SHI = this.mData.BUFF_STU; this.mData.BUFF_STU += 1; targetUnit.NowData.BUFF_SHI = this.mData.BUFF_SHI; targetUnit.DiffData.BUFF_SHI = 1; this.BuffStopMove(); this.BuffStopAttack(); break; } //EventComponent eventCmpt = GameEntry.GetComponent(); //eventCmpt.FireNow(this, new BattleEventReport(WarReport.EReportType.DeBuffAttach, info)); } public void RemovePropertyBuff(YLBattle.Buff buff, YLBattle.EBuffEffect eff) { sm_buff nowbuff = GameConfigData.Ins.GetbuffMo(int.Parse(buff.tid)); // 创建战报 Role cRole = buff.caster; Role tRole = buff.target; WarReport.WarReportInfo info = new WarReport.WarReportInfo(); WarReport.WarReportUnit ownerUnit = new WarReport.WarReportUnit(); WarReport.WarReportUnit targetUnit = new WarReport.WarReportUnit(); ownerUnit.InitData(cRole); targetUnit.InitData(tRole); info.UnitDataOwner.Add(ownerUnit); info.UnitDataTarget.Add(targetUnit); switch (eff) { case YLBattle.EBuffEffect.EBUFF_EFFECT_Shield: this.mData.BUFF_SHI -= 1; targetUnit.NowData.BUFF_SHI = this.mData.BUFF_SHI; break; case YLBattle.EBuffEffect.EBUFF_EFFECT_Silent: this.mData.BUFF_SIL -= 1; //if (this.mData.SIL_Final <= 0) //{ // if (this.mData.STU_Final <= 0 && this.mData.STA_Final <= 0) // { // this.BuffPlayAttack(); // } //} targetUnit.NowData.BUFF_SIL = this.mData.BUFF_SIL; break; case YLBattle.EBuffEffect.EBUFF_EFFECT_Static: this.mData.BUFF_STA -= 1; //if (this.mData.STA_Final <= 0) //{ // if (this.mData.SIL_Final <= 0 && this.mData.STU_Final <= 0) // { // this.BuffPlayAnimation(); // this.BuffPlayAttack(); // this.BuffPlayMove(); // } // else if (this.mData.SIL_Final <= 0) // { // this.BuffPlayAnimation(); // } // else if (this.mData.STU_Final <= 0) // { // this.BuffPlayAnimation(); // this.BuffPlayMove(); // } //} targetUnit.NowData.BUFF_STA = this.mData.BUFF_STA; break; case YLBattle.EBuffEffect.EBUFF_EFFECT_Stun: this.mData.BUFF_STU -= 1; //if (this.mData.STU_Final <= 0) //{ // if (this.mData.SIL_Final <= 0 && this.mData.STA_Final <= 0) // { // this.BuffPlayAttack(); // this.BuffPlayMove(); // } // else if (this.mData.STA_Final <= 0) // { // this.BuffPlayMove(); // } //} targetUnit.NowData.BUFF_STU = this.mData.BUFF_STU; break; } //EventComponent eventCmpt = GameEntry.GetComponent(); //eventCmpt.FireNow(this, new BattleEventReport(WarReport.EReportType.DeBuffCancel, info)); } public int GetLastBuff(string tid, int iid) { return int.Parse(tid) * 100 + iid; } public bool IsDead() { return this.isDie; } public void BuffStopMove() { buffCanMove = false; } public void BuffPlayMove() { buffCanMove = true; } public void BuffStopAnimation() { mAnimator.speed = 0; } public void BuffPlayAnimation() { mAnimator.speed = 1; } public void BuffStopAttack() { buffCanAttack = false; } public void BuffPlayAttack() { buffCanAttack = true; } public void OnTriggerEnter(Collider other) { } }