public void playNextVFX() { if (b_vfx_running || my_buffs.Count == 0) { return; } if (index_buff_vfx >= my_buffs.Count) { index_buff_vfx = 0; } if (my_buffs[index_buff_vfx].my_buff_info.effect == eBuff_Effect.Halo) { index_buff_vfx++; return; } GameObject obj = BKTools.addVFX(PrefabPath.VFX_Buff_Prefix + my_buffs[index_buff_vfx].my_buff_info.duration_vfx + ".prefab"); if (obj) { obj.transform.SetParent(transform, true); //my_buffs[index_buff_vfx].vfx_duration.Add(obj); 暂时仅对halo有效 obj.transform.localPosition = Buff_Info.vfx_off_buff; BuffAnimator ba = obj.GetComponent <BuffAnimator>(); ba.owner = this; Debug.Log("增加" + belong.ToString() + ":" + ba.gameObject.name); b_vfx_running = true; } index_buff_vfx++; }
IEnumerator corFogLift(DramaSection script) { BKTools.FogLift(script.to_grid_id, script.v_int + GameRule.Default_PvE_Fog_Lift_Range, GameRule.Default_PvE_Fog_Lift_Range, GameRule.ePlayerIndex); yield return(new WaitForSeconds(1f)); analya_finish = true; yield return(null); }
//TODO 迷雾目标一般是玩家,这个设定未能在编辑器中设置 IEnumerator corFogCover(DramaSection script) { BKTools.FogCover(script.to_grid_id, script.v_int, GameRule.ePlayerIndex); yield return(new WaitForSeconds(1f)); analya_finish = true; yield return(null); }
/*已经通过接口实现*/ // 更新为加载事件统一处理 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); } }
//绘制距离 void OnDrawGizmos() { if (chess_grids_dist.Count > 0) { foreach (var item in chess_grids_dist) { Gizmos.color = BKTools.HSVtoRGB(1.0f * item.Key / max_grid_dis, 1, 1);; //Gizmos.DrawLine(p1, p2); //Gizmos.DrawSphere(p2, 0.1f); } } }
IEnumerator corShowArea(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); } analya_finish = true; yield return(null); }
public bool isMoveBan(ePlayer runner) { foreach (Buff buff in my_buffs) { if (buff.my_buff_info.effect == eBuff_Effect.Move_BAN) { if (BKTools.IsTargetFit(buff.my_buff_info.my_TargetBelong, runner, buff.stand_side)) { return(true); } } } return(false); }
IEnumerator corHideArea(DramaSection section) { //开放活动区域 foreach (var item in Main.Inst.lv_ctrl.map_data.list_area_grid[section.area_id].list) { //驱散迷雾 BKTools.FogCover(item, 0, GameRule.ePlayerIndex); //记录已探索 if (Main.Inst.lv_ctrl.AreaExplored.Contains(item)) { Main.Inst.lv_ctrl.AreaExplored.Remove(item); } } analya_finish = true; yield return(null); }
/// <summary> /// 以这个方向为标准对齐 /// </summary> /// <param name="dir"></param> public bool AlignGrid(eDirection dir) { ChessContainer target = GetAround(dir); if (target != null) { Vector3 checkpos = Vector3.zero;; checkpos = new Vector3(0, BKTools.chess_container_size.y, 0) * transform.lossyScale.x; int reverse_dir = (int)dir; reverse_dir = (reverse_dir / 2) * 2 + (1 - reverse_dir % 2); checkpos = Quaternion.Euler(0, 0, BKTools.AngularByDirection((eDirection)reverse_dir)) * checkpos; transform.position = target.transform.position + checkpos; UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene()); return(true); } return(false); }
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 corExploreContinue(DramaSection section) { Main.Inst.addDancer(KEYExCont); // 展示战斗成果 Main.Inst.panBattleSummary.Show(); yield return(new WaitUntil(BKTools.ISCWithArgu(KEYExCont))); //开放活动区域 TODO 关闭战斗区域特效 foreach (var item in Main.Inst.lv_ctrl.AreaBattle) { //驱散迷雾 BKTools.FogCover(item, 1, GameRule.ePlayerIndex); } //恢复探索区域 yield return(new WaitUntil(BKTools.ISCWithArgu(KEYExCont))); //清理战斗人员 foreach (var chess in Main.Inst.dic_chess) { chess.Value.container.removeChess(); chess.Value.gameObject.SetActive(false); } // 召回探索骑士 Main.Inst.moving_chess = Main.Inst.now_turnphase.setChess(1001, ePlayer.Player1, Main.Inst.chess_grids[Main.Inst.lv_ctrl.ExplorePos], section.my_argu_AI_ID, false, GameRule.PlayerChessEventID, 0); Main.Inst.b_moving_chess = true; //开放活动区域 foreach (var item in Main.Inst.lv_ctrl.AreaExplored) { //驱散迷雾 BKTools.FogLift(item, 1, GameRule.Default_PvE_Fog_Lift_Range, GameRule.ePlayerIndex); } yield return(new WaitUntil(BKTools.ISCWithArgu(KEYExCont))); // 切换阶段 —— 被清理后自动接上探索 if (Main.Inst.now_turnphase.nextPhaseDefault.gameObject.scene.name != null) { Destroy(Main.Inst.now_turnphase.nextPhaseDefault.gameObject); } Main.Inst.now_turnphase.nextPhaseDefault = Main.Inst.explore_phase; analya_finish = true; Main.Inst.redDancer(KEYExCont); }
public static void initSprite() { if (is_sprite_init) { return; } Sprite sprite; object o; Texture2D t2d; foreach (KeyValuePair <int, Card_Info> _info in Data.Inst.card_data) { //卡牌详情图 o = BKTools.LoadAsset <UnityEngine.Object>(eResBundle.Image, card_path + _info.Value.img + ".png"); t2d = o as Texture2D; sprite = Sprite.Create(t2d, new Rect(0, 0, t2d.width, t2d.height), new Vector2(0.5f, 0.5f)); dic_id_card_sprite.Add(_info.Key, sprite); //手牌图 o = BKTools.LoadAsset <UnityEngine.Object>(eResBundle.Image, hand_path + _info.Value.img + ".png"); t2d = o as Texture2D; sprite = Sprite.Create(t2d, new Rect(0, 0, t2d.width, t2d.height), new Vector2(0.5f, 0.5f)); dic_id_hand_sprite.Add(_info.Key, sprite); //棋子图 o = BKTools.LoadAsset <UnityEngine.Object>(eResBundle.Image, chess_path + _info.Value.img + ".png"); t2d = o as Texture2D; sprite = Sprite.Create(t2d, new Rect(0, 0, t2d.width, t2d.height), new Vector2(0.5f, 0.5f)); dic_id_chess_sprite.Add(_info.Key, sprite); } string[] imgs = new string[3]; imgs[0] = "ion_por"; imgs[1] = "ion_atc"; imgs[2] = "ion_ang"; //手动初始化职业图标 for (int i = 0; i < (int)eCard_Vocation.Max; i++) { o = BKTools.LoadAsset <UnityEngine.Object>(eResBundle.Image, vocation_path + imgs[i % imgs.Length] + ".png"); t2d = o as Texture2D; sprite = Sprite.Create(t2d, new Rect(0, 0, t2d.width, t2d.height), new Vector2(0.5f, 0.5f)); dic_vocation_sprite.Add((eCard_Vocation)i, sprite); } }
//探索开始 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); }
//升起迷雾 //static Vector3 fog_position = new Vector3(0, 0, -2); //淘汰咯,有动画就行了 public void FogCover(int[] target_players) { if (AniFog == null) { //增加sprite //aniFog = Instantiate(Resources.Load<GameObject>(PrefabPath.ChessGridFog), transform).GetComponent<Animator>(); //aniFog = Instantiate(BKTools.getBundleObject(eResBundle.Prefabs,PrefabPath.ChessGridFog), transform).GetComponent<Animator>(); aniFog = Instantiate(BKTools.LoadAsset <GameObject>(eResBundle.Prefabs, PrefabPath.ChessGridFog), transform).GetComponent <Animator>(); } if (aniFogState <= 0) { return; } aniFogState = 0; //清理标记 //Fog_flag = true; foreach (var player in target_players) { fog_flag[player] = true; } StartCoroutine(corFogCover()); }
IEnumerator corBattleStart(DramaSection section) { Main.Inst.addDancer(KEY_corBattleStart); Main.Inst.lv_ctrl.now_turn = 0; // 重新计算回合数 //存储探索进度 Main.Inst.lv_ctrl.ExplorePos = Main.Inst.moving_chess.container.number; // 遮盖已开放区域 foreach (var item in Main.Inst.lv_ctrl.AreaExplored) { BKTools.FogCover(item, 1, GameRule.ePlayerIndex); } yield return(new WaitUntil(BKTools.ISCWithArgu(KEY_corBattleStart))); //隐藏探索骑士 //Main.Inst.moving_chess.container.removeChess(); //Main.Inst.moving_chess.gameObject.SetActive(false); // 开放战斗区域 foreach (var item in Main.Inst.lv_ctrl.map_data.list_area_grid[section.area_id].list) { Main.Inst.lv_ctrl.AreaBattle.Add(item); BKTools.FogLift(item, 1, GameRule.Default_PvE_Fog_Lift_Range, GameRule.ePlayerIndex); } // 召唤玩家默认阵容 //TODO 从牌组设置读取 Main.Inst.moving_chess.container.removeChess(); Main.Inst.chess_grids[section.to_grid_id].appendChess(Main.Inst.moving_chess); //setChessPlayer(1001, ePlayer.Player1, Main.Inst.chess_grids[section.to_grid_id]); Debug.Log("草拟吗,到底能不能玩断点啦!"); // 切换阶段 (不能使用插入,不然会使得当前不止一个阶段对象响应事件——已经造成过召唤剧情成功生成未执行时被认为已经被杀光的错误 AppendPhase(Instantiate(BKTools.LoadAsset <GameObject>(eResBundle.Prefabs, PrefabPath.PlayerDrawPhase), Main.Inst.NodePhaseControler.transform).GetComponent <TurnPhase>()); Main.Inst.redDancer(KEY_corBattleStart); //召唤怪物阵容 - 由原来的事件机制完成 //设置镜头跟踪方式 Camera.main.GetComponent <ExBaCamera>().SetFollowTarget(section.area_id); analya_finish = true; }
public static void analyseBuff_Effect(Buff buff, eBuffEvent buff_event) { if (buff.my_buff_info.my_event != buff_event) { if (buff.my_buff_info.my_event == eBuffEvent.Buff_Exist && (buff_event == eBuffEvent.Buff_Add || buff_event == eBuffEvent.Buff_Remove) ) { //如果是持续效果,则在增加和删除时触发效果 } else if (buff.my_buff_info.my_event == eBuffEvent.Phase_Prepare && buff_event == eBuffEvent.Buff_Add) { //如果是每回合造成一次效果的,会在添加时触发效果 } else { return; } } // continue switch (buff.my_buff_info.effect) { case eBuff_Effect.DOT: if (buff.owner_ch != null) { DamageInfo new_dmg = new DamageInfo(buff.my_buff_info.values[0]); buff.owner_ch.on_damage(new_dmg); } break; case eBuff_Effect.Move_BAN: //无 //经过无数坑踩过后,决定这边在添加时做逻辑处理,仅显示表现 // if (buff.owner_chc != null && (buff_event == eBuffEvent.Buff_Add/* || buff_event == eBuffEvent.Phase_Prepare*/)) // { // BK_AnimEvts av = BKTools.addVFX(buff.owner_chc.Main.Instance.bg_unmovable_start); // av.transform.position = buff.owner_chc.transform.position + new Vector3(0, 0, -0.8f); // } // if (buff.owner_chc != null) // { // if (buff_event == eBuffEvent.Buff_Add) // { // switch (buff.my_buff_info.my_TargetBelong) // { // case eSkill_TargetBelong.Both_Player: // buff.owner_chc.setMoveBan(ePlayer.Max); // break; // case eSkill_TargetBelong.Opponent: // ePlayer target = ePlayer.Player1; // if (buff.stand_side == ePlayer.Player1) // { // target = ePlayer.Player2; // } // buff.owner_chc.setMoveBan(target); // break; // case eSkill_TargetBelong.Teammate: // buff.owner_chc.setMoveBan(ePlayer.Max); // break; // default: // break; // } // // } else if (buff_event == eBuffEvent.Buff_Remove) // { // buff.owner_chc.setMoveBan(ePlayer.None); // } // } break; case eBuff_Effect.Attack_BAN: break; case eBuff_Effect.Halo: List <ChessContainer> list = BKTools.GetSkillScope(buff, buff.owner.getContainer()); foreach (ChessContainer cc in list) { if (cc.my_chess != null) { //检查目标类型是否符合 if (BKTools.IsTargetFit(buff.my_buff_info.my_TargetBelong, cc.my_chess.belong, buff.stand_side)) { foreach (int id in buff.my_buff_info.values) { cc.my_chess.AddBuff(new BuffAdder(buff.stand_side, id)); Debug.Log("哎呀~~~又加了一个 card_id:" + cc.my_chess.attribute.card_id); } } } if ((int)buff.my_buff_info.my_TargetBelong > 2) // 3、4、5地面效果 { foreach (int id in buff.my_buff_info.values) { cc.AddBuff(new BuffAdder(buff.stand_side, id)); Debug.Log("哎呀~~~又加了一个格子_id:" + cc.number); } // switch (buff.my_buff_info.my_TargetBelong) // { // case eSkill_TargetBelong.地面中立: // cc.B_unmovable = true; // break; // default: // Debug.Log("warning 填写的BUFF 目标类型尚未实现,填你妈逼。 buff id : " + buff.my_buff_info.id); // break; // } } } break; default: Debug.Log("buff效果ID错误。buff id-" + buff.my_buff_info.id); break; } }