//走棋 操作响应 override public void moveChessPlayer(ChessContainer targetContainer) { //没有行动次数限制 if (Main.Inst.moving_chess == null) { return; } //未探索出的区域不能在这个模式下进入 if (!Main.Inst.lv_ctrl.AreaExplored.Contains(targetContainer.number)) { return; } FindPathTo(targetContainer.number); if (chess_grids_dist[Main.Inst.moving_chess.container.number] > 0) { target_grid = targetContainer; is_walking = true; //move_countdown = move_duration; move_interval_countdown = float.Epsilon; MoveStep(); } //moveChess(Main.Inst.moving_chess, targetContainer, false); }
//逻辑部分,时间表现在外面 void MoveStep() { //结束条件 if (next_grid == target_grid) { is_walking = false; return; } ChessContainer nearest = null; int lastdist = 999; foreach (var item in Main.Inst.dGetChessContainer) { ChessContainer _cc = item(Main.Inst.moving_chess.container); if (_cc == null) { continue; } if (chess_grids_dist[_cc.number] == -1) { continue; } if (lastdist == 999 || chess_grids_dist[_cc.number] < lastdist) { lastdist = chess_grids_dist[_cc.number]; nearest = _cc; } } StepCount++; pre_grid = Main.Inst.moving_chess.container; next_grid = nearest; }
public static bool judgePassable(Chess c, ChessContainer grid) { switch (grid.terrain_type) { case eMapGridType.Unvailable: case eMapGridType.Gap: return(false); default: return(true); } }
//下棋 探索模式没有召唤截断操作 override public void setChessPlayer(int card_id, ePlayer card_belong, ChessContainer grid) { return; if (Main.Inst.select_card == null || Main.Inst.moving_chess != null) { return; } setChess(card_id, card_belong, grid, AI.eAI_Type.Default, false, GameRule.PlayerChessEventID, 0); Debug.Log("从explore召唤"); return; }
IEnumerator corMove(DramaSection section) { //移动者 TODO 解析要改成后面多4位的形式 暂不修改 int id = section.chess_id; Chess ch = Main.Inst.dic_chess[id]; StartMoveChess(ch); Main.Inst.addDancer("move-" + id); yield return(new WaitForSeconds(GameRule.Moveing_Duration)); Main.Inst.redDancer("move-" + id); //移动方式 eDOType_Move movetype = section.move_type; bool is_force_move = false; ChessContainer grid = null; Point3 locater = section.move_argu; switch (movetype) { case eDOType_Move.Force_Move_ABS: is_force_move = true; grid = Main.Inst.chess_grids[locater.x]; break; case eDOType_Move.Force_Move_REL: is_force_move = true; grid = BKTools.LocateChessGrid(ch.container, locater); break; case eDOType_Move.Normal_Move_ABS: grid = Main.Inst.chess_grids[locater.x]; break; case eDOType_Move.Norma_lMove_REL: grid = BKTools.LocateChessGrid(ch.container, locater); break; default: Debug.LogError("剧情移动方式错误"); break; } moveChess(ch, grid, false); yield return(null); }
IEnumerator corShoukan(DramaSection section) { // int id = int.Parse (script.my_argu [0]); // ePlayer belong = (ePlayer)int.Parse (script.my_argu [1]); // ChessContainer grid = Main.Instance.chess_grids [int.Parse (script.my_argu [2])]; int id = section.chess_id; ePlayer belong = section.belong; ChessContainer grid = Main.Inst.chess_grids[section.to_grid_id]; //创建棋子 Main.Inst.addDancer("shoukan-" + id);//召唤操作会直接开始清理流程,我还没加标记呢,草拟吗的 int shoukan_sequence = Chess.GetSequenceInEvent(section.from_event); Main.Inst.now_turnphase.setChess(id, belong, grid, section.my_argu_AI_ID, true, section.from_event, shoukan_sequence); yield return(new WaitForSeconds(GameRule.Shoukan_Duration)); Main.Inst.redDancer("shoukan-" + id); analya_finish = true; }
public static ChessContainer LocateChessGrid(ChessContainer now_cc, Point3 relativePosition) { ChessContainer cc; cc = now_cc; for (int x = 0; x < Mathf.Abs(relativePosition.x); x++) { if (relativePosition.x > 0) { cc = cc.CCLowerRight;//Main.Instance.getRightLowerChessContainer(cc); } else { cc = cc.CCUpperLeft;//Main.Instance.getLeftUpperChessContainer(cc); } } for (int y = 0; y < Mathf.Abs(relativePosition.y); y++) { if (relativePosition.y > 0) { cc = cc.CCLower;//Main.Instance.getLowerChessContainer(cc); } else { cc = cc.CCUpper;//Main.Instance.getUpperChessContainer(cc); } } for (int z = 0; z < Mathf.Abs(relativePosition.z); z++) { if (relativePosition.z > 0) { cc = cc.CCLowerLeft; } else { cc = cc.CCUpperRight; } } return(cc); }
//探索开始 IEnumerator corExploreStart(DramaSection section) { //开房活动区域 foreach (var item in Main.Inst.lv_ctrl.map_data.list_area_grid[section.area_id].list) { //驱散迷雾 BKTools.FogLift(item, 1, GameRule.Default_PvE_Fog_Lift_Range, GameRule.ePlayerIndex); //记录已探索 Main.Inst.lv_ctrl.AreaExplored.Add(item); } //召唤王 int temp_lord_id = 1001; ePlayer belong = section.belong; ChessContainer grid = Main.Inst.chess_grids[section.to_grid_id]; //创建棋子 Main.Inst.moving_chess = Main.Inst.now_turnphase.setChess(temp_lord_id, ePlayer.Player1, grid, section.my_argu_AI_ID, false, GameRule.PlayerChessEventID, 0); //设置镜头跟踪方式 Camera.main.GetComponent <ExBaCamera>().SetFollowTarget(Main.Inst.moving_chess); analya_finish = true; yield return(null); }
void DistDFS_Explored(int now_pos, int nowdis) { foreach (var item in Main.Inst.dGetChessContainer) { ChessContainer cc = item(Main.Inst.chess_grids[now_pos]); if (cc == null) { continue; } if (chess_grids_dist[cc.number] == -1) { continue; } if (nowdis < chess_grids_dist[cc.number] || chess_grids_dist[cc.number] == 0) { if (GameRule.judgePassable(Main.Inst.moving_chess, cc)) { chess_grids_dist[cc.number] = nowdis; if (nowdis > max_grid_dis) { max_grid_dis = nowdis; } } else { chess_grids_dist[cc.number] = -1; } if (chess_grids_dist[cc.number] != -1) { DistDFS_Explored(cc.number, chess_grids_dist[cc.number] + 1); } } } return; }
/*已经通过接口实现*/ // 更新为加载事件统一处理 public static void addBuff(ref List <BuffAdder> list_adder, CBuffContain container, Chess ch, ChessContainer chc, string dancer_key) { // { // Buff new_buff = new Buff(); // //new_buff.my_buff_info.id = buff_id; // new_buff.my_buff_info = Data.Inst.buff_data[buff_id]; // c.my_buffs.Add(new_buff); // } BuffAdder[] adds = new BuffAdder[list_adder.Count]; list_adder.CopyTo(adds); list_adder.Clear(); List <Buff> my_buffs = container.getBuffList(); //异步添加BUFF foreach (BuffAdder buff_id in adds) { //做法修改后不再需要判断重复 // if (my_buffs.ContainsKey(buff_id)) // { // Debug.Log("加buff失败,找不到buff,ID:" + buff_id); // return; // } else if (!my_buffs.ContainsKey(buff_id)) { Buff new_buff = new Buff(); new_buff.stand_side = buff_id.from; new_buff.my_buff_info = Data.Inst.buff_data[buff_id.id]; new_buff.my_Duration = new_buff.my_buff_info.duration; my_buffs.Add(new_buff); new_buff.owner_ch = ch; new_buff.owner_chc = chc; new_buff.owner = container; BuffContrllor.analyseBuff_Effect(new_buff, eBuffEvent.Buff_Add); BK_AnimEvts av = BKTools.addVFX_Dancer(new_buff.my_buff_info.start_vfx); if (av) { av.transform.position = container.getContainer().transform.position; } // 持续特效 if (new_buff.my_buff_info.effect == eBuff_Effect.Halo) { GameObject obj = BKTools.addVFX(PrefabPath.VFX_Buff_Prefix + new_buff.my_buff_info.duration_vfx + ".prefab"); if (obj) { obj.transform.SetParent(container.transform, true); new_buff.vfx_duration.Add(obj); //暂时仅对halo有效 obj.transform.localPosition = Vector3.forward * 0.2f; } } else { container.playNextVFX(); } } Main.Inst.redDancer(dancer_key); } }
//走棋 执行 override public void moveChess(Chess moving_chess, ChessContainer targetContainer, bool trigger_strike) { moving_chess.container.removeChess(); targetContainer.appendChess(moving_chess); CheckMoveEvent(moving_chess, nextPhaseDefault); }
public static List <ChessContainer> GetSkillScope(ILocation_Scope skill, ChessContainer now_cc, eDirection direction_limit) { List <ChessContainer> list = new List <ChessContainer>(); ChessContainer cc; switch (skill.iLS_Locater) { case eSkill_Scope_Locator.Board_Location: //cc = Main.Instance cc = Main.Inst.chess_grids[getChessContainer(skill.iLS_Point.x, skill.iLS_Point.y)]; break; case eSkill_Scope_Locator.Chess_Location: cc = now_cc; break; case eSkill_Scope_Locator.Related_Location: //Debug.Log("谁让你填相对坐标的,没人告诉你功能没做好吗! 技能ID" + skill.id); cc = LocateChessGrid(now_cc, skill.iLS_Point); // for (int x = 0; x < Mathf.Abs(skill.iLS_Point.x); x++) { // if (skill.iLS_Point.x > 0) { // cc = Main.Instance.getRightLowerChessContainer(cc); // } else { // cc = Main.Instance.getLeftUpperChessContainer(cc); // } // } // for (int y = 0; y < Mathf.Abs(skill.iLS_Point.y); y++) { // if (skill.iLS_Point.y > 0) { // cc = Main.Instance.getLowerChessContainer(cc); // } else { // cc = Main.Instance.getUpperChessContainer(cc); // } // } // for (int z = 0; z < Mathf.Abs(skill.iLS_Point.z); z++) { // if (skill.iLS_Point.z > 0) { // cc = Main.Instance.getLeftLowerChessContainer(cc); // } else { // cc = Main.Instance.getRightUpperChessContainer(cc); // } // } break; default: Debug.Log("神特么default。技能起点信息错误!"); return(null); } list.Add(cc); foreach (eSkill_Scope _scope in skill.iLS_Scope) { switch (_scope) { case eSkill_Scope.Circle: // 一圈 //cc.search_around(ref list, 0, skill.iLS_Depth); list = getAroundGrid(skill.iLS_Depth, list); break; case eSkill_Scope.Up: // 上 case eSkill_Scope.Down: // 下 case eSkill_Scope.RightUp: // 右上 case eSkill_Scope.LeftDown: // 左下 case eSkill_Scope.LeftUp: // 左上 case eSkill_Scope.RightDown: // 右下 int index = (int)_scope - 1; ChessContainer _cc = cc; for (int i = 0; i < skill.iLS_Depth; i++) { // 限制攻击范围 if (direction_limit != eDirection.All && i != (int)direction_limit) { continue; } _cc = Main.Inst.dGetChessContainer[index](_cc); if (_cc != null) { list.Add(_cc); } else { break; } } break; default: Debug.Log("技能范围,形状参数错误。"); break; } } return(list); }
public static List <ChessContainer> GetSkillScope(ILocation_Scope skill, ChessContainer now_cc) { return(GetSkillScope(skill, now_cc, eDirection.All)); }