public void DoColliderAction(ICharaBattle player) { _colliderCount++; if (_colliderInfo.ColliderMax != -1 && _colliderCount >= _colliderInfo.ColliderMax) { Complete(); return; } if (null != _colliderInfo.FightEffectList && _colliderInfo.FightEffectList.Count > 0) { Vector3 dir = new Vector3(_collider.x, 0, _collider.y); dir = (player.MovePos - dir).normalized; for (int i = 0; i < _colliderInfo.FightEffectList.Count; i++) { FightEffectInfo info = _colliderInfo.FightEffectList[i]; if (info.EffectTarget == FIGHT_EF_TARGET.SELF) { FightEffectDefine.ParseEffect(_skillPlayer, info, _skillPlayer.BattleId, dir); } else { SkillCommand command = null; if (info.EffectType == FIGHT_EF_TPYE.ACTION) { uint frame = ZTBattleSceneManager.GetInstance().SceneFrame; command = FightDefine.GetSkillCommand(player.BattleId, frame, info.Param1, dir, player.MovePos); } FightEffectDefine.ParseEffect(player, info, _skillPlayer.BattleId, dir, command); } } } }
public void UpdateLate() { if (null == _addSkillCommand || _addSkillCommand.Count == 0) { return; } while (_addSkillCommand.Count > 0) { SkillCommand command = _addSkillCommand[0]; _addSkillCommand.RemoveAt(0); if (null != command) { ICharaBattle battleInfo = ZTBattleSceneManager.GetInstance().GetCharaById(command.BattleId) as ICharaBattle; if (null == battleInfo) { return; } if (!_skillParserDic.ContainsKey(command.BattleId)) { _skillParserDic.Add(command.BattleId, new List <SkillActionParser>()); } SkillActionParser skillParser = new SkillActionParser(battleInfo, command); _skillParserDic[battleInfo.BattleId].Add(skillParser); } } }
//刷新对象 public override void UpdateActoin(uint curFrame = 0) { base.UpdateActoin(curFrame); if (_moveCount > _moveInfo.FrameCount) { return; } _moveCount++; Vector3 targetPos = _actionParser.Command.TargetPos; if (_actionParser.Command.TargetId > 0) { ICharaBattle battleInfo = ZTBattleSceneManager.GetInstance().GetCharaById(_actionParser.Command.TargetId) as ICharaBattle; if (null != battleInfo) { targetPos = battleInfo.MovePos; } } bool moveDone = SkillMethod.MoveAction(_collider, _moveInfo, _actionParser.Command.SkillDir, targetPos, _skillPlayer.MovePos); if (moveDone) { DoneEndMoveAction(); Complete(); } }
private static void AddBuff(ICharaBattle battleInfo, FightEffectInfo effect, uint userId) { if (userId <= 0) { return; } battleInfo.AddBuff(new BuffData(effect.Param1, ZTBattleSceneManager.GetInstance().SceneFrame, userId)); }
//收到玩家进入场景 public void ParseReborn(BPReborn bp) { ICharaBattle info = ZTBattleSceneManager.GetInstance().GetCharaById(bp.BattleId) as ICharaBattle; if (null != info) { info.Reborn(); } }
public void UpdatePos(BPBattle bp) { ICharaBattle info = ZTBattleSceneManager.GetInstance().GetCharaById(bp.BattleId) as ICharaBattle; if (null != info) { info.MovePos = bp.Pos; } }
public void GameStart() { GameManager.GameInit = true; GameStartEvent.GetInstance().dispatchEvent(GAME_LOAD_SETP_EVENT.LOAD_COM); ZTBattleSceneManager.GetInstance().Init(); //ZTXLuaEnv.GetInstance().Init(); //测试 Test(); }
public override void Destroy() { LocalString.Destroy(); PathManager.Destroy(); ZTBattleSceneManager.GetInstance().Destroy(); //SpriteFaceCache.Destory(); //AssetManager.Destroy(); //ZTXLuaEnv.GetInstance().Destroy(); GameManager.GameInit = false; }
//震屏 private static void SharkScreen(ICharaBattle battleInfo, FightEffectInfo effect, uint userId) { //非玩家自己 不需要震动 if (battleInfo.BattleId == ZTBattleSceneManager.GetInstance().MyPlayer.BattleId || userId == ZTBattleSceneManager.GetInstance().MyPlayer.BattleId) { int time = effect.Param1; float offset = effect.Param2 / IntToFloat; ZTBattleSceneManager.GetInstance().SharkScreen(time, offset); } }
// Update is called once per frame void Update() { if (GameManager.GameInit == false) { return; } //战斗刷新 场景刷新 统一通过ZTBattleSceneManager update内部调用 ZTBattleSceneManager.GetInstance().Update(); }
public static uint MaxFrame = uint.MaxValue; //60帧每秒 理论上可以计数400多天 public static bool CompareFrame(uint frame) { uint curFrame = ZTBattleSceneManager.GetInstance().SceneFrame; if (curFrame >= frame) { return(true); } return(false); }
public void DoneEndMoveAction() { //指定目标 if (_colliderInfo.ColliderType == CollBase.ColType.TARGET) { ICharaBattle battleInfo = ZTBattleSceneManager.GetInstance().GetCharaById(_actionParser.Command.TargetId) as ICharaBattle; if (null != battleInfo) { DoColliderAction(battleInfo); } } }
//发送操作指令 private void SendMoveCommond(MOVE_DIR dir) { uint battleId = ZTBattleSceneManager.GetInstance().MyPlayer.BattleId; if (_moveDir != dir && battleId > 0 && ZTBattleSceneManager.GetInstance().MyPlayer.MoveDir != dir) { _moveDir = dir; BattleProtocol.GetInstance().SendMoveComand(battleId, dir); //MoveCommand command = FightDefine.GetMoveCommand(battleId, dir); //SceneEvent.GetInstance().dispatchEvent(SCENE_EVENT.ADD_COMMAND, new Notification(command)); } }
//激活行为 public void ActionActivatebyId(uint id) { if (_skillActionDic.ContainsKey(id)) { for (int i = _skillActionDic[id].Count - 1; i >= 0; i--) { SkillActionBase skillActoin = _skillActionDic[id][i]; skillActoin.IsStart = true; skillActoin.ActFrame = ZTBattleSceneManager.GetInstance().SceneFrame; } } }
public BPBattle(uint battleId) { BattleId = battleId; Frame = ZTBattleSceneManager.GetInstance().SceneFrame; Pos = new Vector3(400, 0, 400); ICharaBattle info = ZTBattleSceneManager.GetInstance().GetCharaById(battleId) as ICharaBattle; if (null != info) { Pos = info.MovePos; } }
private static void CalculateHurt(ICharaBattle battleInfo, FightEffectInfo effect, uint userId) { ICharaFight target = battleInfo as ICharaFight; ICharaFight user = ZTBattleSceneManager.GetInstance().GetCharaById(userId) as ICharaFight; if (null == target || null == user) { return; } HurtInfo hurtInfo = new HurtInfo(); hurtInfo.Type = HURT_TYPE.NORMAL; hurtInfo.BattleId = battleInfo.BattleId; hurtInfo.Pos = battleInfo.MovePos; hurtInfo.Value = -user.Attack; target.AddHurt(hurtInfo); }
//===================================目标选择================================================= public static List <ICharaBattle> GetTargetList(ICharaBattle battleInfo, SkillDefine.ColliderTarget targetType) { List <ICharaBattle> targetList = new List <ICharaBattle>(); if (targetType == SkillDefine.ColliderTarget.SELF) { targetList.Add(battleInfo as ICharaBattle); return(targetList); } List <CharaActorInfo> list = ZTBattleSceneManager.GetInstance().GetCharaList(); for (int i = 0; i < list.Count; i++) { ICharaBattle info = list[i] as ICharaBattle; //过滤死亡玩家 if (null != info && !info.IsDead()) { switch (targetType) { case SkillDefine.ColliderTarget.TEAM: if (battleInfo.Camp == info.Camp) { targetList.Add(info); } break; case SkillDefine.ColliderTarget.ENEMY: if (battleInfo.Camp != info.Camp) { targetList.Add(info); } break; case SkillDefine.ColliderTarget.ALL: targetList.Add(info); break; } } } return(targetList); }
public void UpdateAction() { bool allIsDone = true; if (null != _skillActionDic) { uint curFrame = ZTBattleSceneManager.GetInstance().SceneFrame; //帧率溢出 补足 if (curFrame < Command.StartFrame) { curFrame += uint.MaxValue - Command.StartFrame; } foreach (uint key in _skillActionDic.Keys) { for (int i = _skillActionDic[key].Count - 1; i >= 0; i--) { SkillActionBase skillActoin = _skillActionDic[key][i]; if (!skillActoin.IsStart && curFrame >= skillActoin.ActFrame) { skillActoin.IsStart = true; } if (skillActoin.IsStart && !skillActoin.IsComplete) { skillActoin.UpdateActoin(curFrame); } if (skillActoin.ActFrame > 0 && !skillActoin.IsComplete) { allIsDone = false; } } } if (allIsDone) { Destroy(); } } }