public bool FE_AddHit(int hitenemycount, int hash, int hitcount, string prop, int add, BeHurtStateTable attackeffect, bool hold, bool hurtfriend) { if (ap.attackmap.Count == 0) { return(false); } //Debug.Log("FE_AddHit:" + hitcount + "," + prop + "," + add + "," + enemytostate); //得到冲突 foreach (var dest in ap.attackmap) { if (hitenemycount == 0) { break; } hitenemycount--; if (battleField.GetCharactorController(dest.Key).Death) { continue; } var fe = battleField.GetFightEvent(this.id, dest.Key); if (fe.AddHit(this.id, hash, hitcount, prop, add, attackeffect, dest.Value, hold, hurtfriend)) { return(true); } } return(false); //throw new NotImplementedException(); }
/// <summary> /// /// </summary> /// <param name="id">被击者</param> /// <param name="from">攻击者</param> /// <param name="piece">攻击效果</param> /// <param name="_attackdir">攻击者方向</param> public void OnFight_BeHit(int id, int from, FightEffectPiece piece, float posx) { //UGUIFlyHp.Instance().init(UGUIFlyHp.FlyEffect.DecHp, "- 15", GetTransform().position, id); /* Debug.Log(id + "被" + from + "打了");*/ Debug.Log("idhold:" + fightFSM.charLogic.idHold); //判断是否处于抓技 if (fightFSM.charLogic.idHold != -1) { var tc = battleField.GetCharactorController(fightFSM.charLogic.idHold) as CharController_Direct; if (tc != null) { tc.fightFSM.ChangeBlock("stand", 0); } //中断抓技 Debug.Log("中断抓技"); fightFSM.FE_LetGo(); } //攻击功能 /* Debug.Log("prop=" + piece.prop.ToLower() + "=" + piece.add);*/ int v = logicchar.GetParam(piece.prop.ToLower()); //BattleMainLogic test = new BattleMainLogic(); ////这个id是英雄 //if(test.GetCurHeroIndex==id v += piece.add; logicchar.SetParam(piece.prop.ToLower(), v); //攻击效果 if (piece.beHurtState == null) { return; } bool left = (posx < GetTransform().position.x); //打我的人在我左边还是右边 int firedir = left ? 1 : -1; int mydir = this.aniplayer.dir; //面对 ,(mydir =-1 && leftorright==1) || (mydir=1 && leftorright==-1); //or 背对 bool bFaceToMe = (left && mydir == -1) || (!left && mydir == 1); foreach (var e in piece.beHurtState.effects) { if (e.onstate == "any" || e.onstate == fightFSM.GetCurStateName)//当前状态符合 { if (e.facetome == bFaceToMe) { //播放暂停 aniplayer.PlayPause(e.enemypauseframe); //攻击者暂停 (battleField as BattleField).GetRealChar(from).transform.GetComponent <AniPlayer>().PlayPause(e.mypauseframe); //改变状态 fightFSM.ChangeBlockDelay(e.enemytostate, 0); string fire = e.hitfire; string sound = e.hitsound; //播放特效 if (!string.IsNullOrEmpty(fire) && fire != "") { if (battleField.world.extplayer != null) { battleField.world.extplayer.PlayEffect(fire, piece.firepos, firedir); } } //播放音效 if (!string.IsNullOrEmpty(sound) && sound != "") { if (battleField.world.extplayer != null) { battleField.world.extplayer.PlaySoundOnce(sound); } } break; } } } }