/// <summary> ///开始地图和目标 /// </summary> /// <param name="mapID"></param> /// <param name="targetId"></param> public Distance(Execute e, int mapID, int targetId, FinishCallBack callback) { list = model.MhxyRouterRec.GetRouterAll(mapID, targetId); this.hwnd = e.hwnd.ToInt32(); this.ex = e; this.callback = callback; //判断当前地图所在位置,是否需要继续寻路 for (int i = 0; i < list.Count; i++) { if (list[i].mapExit.toMap.map_no == Global.addr.GetMapID(hwnd)) { if (list.Count - 1 > i) { idx = i + 1; } else { idx = i; } } //坐标偏移 bean.Axis a = OffsetAxis(list[i].mapExit.wait_x, list[i].mapExit.wait_y, -1, 2, -2, 2); model.MhxyAxis ma = RandomAxis(list[i].mapExit.id, 1); if (ma != null) { a = new bean.Axis(ma.x, ma.y); } list[i].mapExit.wait_x = a.x; list[i].mapExit.wait_y = a.y; } if (idx <= list.Count - 1) { Log.WriteLine("开始地图:{0}", list[idx].mapExit.myMap.name); } }
public Download(String songId, String songType, String rootPath, FinishCallBack func) { inf = new SongInformation(); inf.songId = songId; inf.songType = songType; this.rootPath = rootPath; this.func = func; }
public void ShowDialogue(List <Component.DialogueData> dialogue, FinishCallBack callback) { m_DialogueDataList = dialogue; m_CurrentDialogueIdx = 0; m_Callback = callback; UpdateDialogue(); gameObject.SetActive(true); }
public void FinishDialogue() { gameObject.SetActive(false); m_DialogueDataList = null; m_CurrentDialogueIdx = 0; if (m_Callback != null) { m_Callback(); m_Callback = null; } }
/// <summary> ///开始地图和目标 /// </summary> /// <param name="mapID"></param> /// <param name="targetId"></param> public Distance(Execute e, int mapID, int targetId, FinishCallBack callback) { list = model.MhxyRouterRec.GetRouterAll(mapID, targetId); this.hwnd = e.hwnd.ToInt32(); this.ex = e; this.callback = callback; //判断当前地图所在位置,是否需要继续寻路 for (int i = 0; i < list.Count; i++) { if (list[i].mapExit.toMap.map_no == Global.addr.GetMapID(hwnd)) { if (list.Count - 1 > i) { idx = i + 1; } else { idx = i; } } } Log.WriteLine("开始地图:{0}", list[idx].mapExit.myMap.name); }
void ActionOver(int data) { caster_.ControlEntity.SetAnimationParam(GlobalValue.FMove, AnimatorParamType.APT_Float, GlobalValue.MoveMinGap); caster_.ControlEntity.ResetState(); if (finish_call_back_ != null) { finish_call_back_(); for (int i = 0; i < aims_.Length; ++i) { aims_[i].ControlEntity.ExcuteState(EntityActionController.StateInst.ExcuteType.ET_Work); } } else { //最终回调没掉过就没了?? 草 手动调!! ClientLog.Instance.LogError("WTF!!!!"); caster_.ControlEntity.FinishShow(); } finish_call_back_ = null; GlobalInstanceFunction.Instance.OnDeadFinish -= OnDealDeadFinish; GlobalInstanceFunction.Instance.openTimer_ = false; //crt_data_ = null; }
void Update() { if (gameObject == null) { DestorySelf(); return; } // 不激活直接返回 if (!active_) { return; } //行为不是陨石的 if (eb_data_.work_type_ == EffectBehaviourData.WORKTYPE.T && eb_data_.id_ != 13) { transform.localRotation = Quaternion.identity; } // 生存时间累加 live_time_ += Time.deltaTime; if (eb_data_.dmage_hit1_ == -1) { beattack_timer_ = true; } if (beattack_timer_) { take_damage_time_ += Time.deltaTime; } // 目的地不为空才会有移动 if (crt_aim_ != null) { if (!effect_stop_move_) { // 直线行进 if (eb_data_.move_type_.Equals(EffectBehaviourData.MOVETYPE.Straight) || force_straight_) { transform.position = Vector3.Lerp(from_, crt_aim_.pos_, (lerp_time_ += Time.deltaTime) / eb_data_.move_time_); transform.LookAt(crt_aim_.pos_); } // 曲线行进 else if (eb_data_.move_type_.Equals(EffectBehaviourData.MOVETYPE.Bezier)) { transform.position = bezier_.GetPointAtTime((lerp_time_ += Time.deltaTime) / eb_data_.move_time_); } // 暂不处理 else { } } if (eb_data_.dmage_hit1_ > 0f && live_time_ > eb_data_.dmage_hit1_ && reach_call_back_1_ != null) { reach_call_back_1_(GetValidateIndex(crt_aim_.index_, reach_back_index)); reach_call_back_1_ = null; //受击计时器启动 beattack_timer_ = true; //特效停止移动 effect_stop_move_ = true; } // 如果初始点和目的地距离小于0.1f 则视为到达目的地 if (active_ && Vector3.Distance(transform.position, crt_aim_.pos_) < 0.1f) { // 调用到达回调 if (eb_data_.dmage_hit1_ == -2 && reach_call_back_1_ != null) { reach_call_back_1_(GetValidateIndex(crt_aim_.index_, reach_back_index)); reach_call_back_1_ = null; lerp_time_ = 0f; //受击计时器启动 beattack_timer_ = true; //特效停止移动 effect_stop_move_ = true; } } #region 处理自受击1开始的所有回调 if (take_damage_time_ > eb_data_.beattack_effect_ && eb_data_.beattack_effect_ != -1 && reach_call_back_eff_ != null) { reach_call_back_eff_(GetValidateIndex(crt_aim_.index_, reach_back_index)); reach_call_back_eff_ = null; } if (take_damage_time_ > eb_data_.pop_value_ && eb_data_.pop_value_ != -1 && reach_call_back_pop_ != null) { reach_call_back_pop_(GetValidateIndex(crt_aim_.index_, reach_back_index)); reach_call_back_pop_ = null; } if (take_damage_time_ > eb_data_.dmage_hit2_ && eb_data_.dmage_hit2_ != -1 && reach_call_back_2_ != null) { reach_call_back_2_(GetValidateIndex(crt_aim_.index_, reach_back_index)); reach_call_back_2_ = null; //特效继续移动 effect_stop_move_ = false; // 更新下一个目的地 if (aimsQue_ != null && aimsQue_.Count > 0 && active_) { from_ = transform.position; crt_aim_ = aimsQue_.Dequeue(); //transform.LookAt(crt_aim_.pos_); if (aimsQue_.Count == 0 && true /*feng skill*/) { transform.parent = null; force_straight_ = true; } } else { crt_aim_ = null; } } #endregion } if (eb_data_.shake_time_ != -1 && !cameraShake_ && live_time_ > eb_data_.shake_time_) { iTween.ShakePosition(Camera.main.gameObject, Vector3.one * 0.1f, 0.5f); cameraShake_ = true; } // 如果生存时间大于endTime则调用完成回调以便衔接下一个动作 if (live_time_ > eb_data_.end_time_ && finish_call_back_ != null) { DealNotExcuteHandler(); finish_call_back_(); finish_call_back_ = null; } // 生存时间大于销毁时间则销毁实例 if (eb_data_.destory_time_ > 0f && live_time_ > eb_data_.destory_time_) { DealNotExcuteHandler(); DestorySelf(); } }
public void Do(BattleActor caster, BattleActor aim, FinishCallBack callback) { callBack_ = callback; caster_ = caster; aim_ = aim; if (caster_ != null) { EffectInst[] effs = caster_.ControlEntity.ActorObj.GetComponentsInChildren <EffectInst>(); for (int i = 0; i < effs.Length; ++i) { effs[i].DealNotExcuteHandler(); effs[i].DestorySelf(); } } caster.ControlEntity.ActorObj.SetActive(false); caster.ControlEntity.ActorObj.transform.position = aim.ControlEntity.ActorObj.transform.position + aim.ControlEntity.ActorObj.transform.forward * -0.5f; caster.ControlEntity.ActorObj.transform.LookAt(aim.ControlEntity.ActorObj.transform); GlobalInstanceFunction.Instance.Invoke(() => { caster.ControlEntity.ActorObj.SetActive(true); EffectAPI.PlaySceneEffect(EFFECT_ID.EFFECT_Kill, Vector3.zero, aim_.ControlEntity.ActorObj.transform, KillEffCallBack, true); GlobalInstanceFunction.Instance.Invoke(() => { caster.ControlEntity.MoveTo(aim.ControlEntity.ActorObj.transform.position + aim.ControlEntity.ActorObj.transform.forward, (int data) => { GlobalInstanceFunction.Instance.Invoke(() => { if (killEff != null) { GameObject.Destroy(killEff); } aim.SetIprop(PropertyType.PT_HpCurr, 0); if (aim.InstId == GamePlayer.Instance.InstId) { AttaclPanel.Instance.ChangeValue(PropertyType.PT_HpCurr, GamePlayer.Instance.GetIprop(PropertyType.PT_HpMax) * -1, GamePlayer.Instance.GetIprop(PropertyType.PT_HpMax), GamePlayer.Instance.GetIprop(PropertyType.PT_MpMax)); } if (Battle.Instance.SelfActorBattleBaby != null) { if (aim.InstId == Battle.Instance.SelfActorBattleBaby.InstId) { AttaclPanel.Instance.ChangeValueBaby(PropertyType.PT_MpCurr, aim.battlePlayer.hpMax_ * -1, aim.battlePlayer.hpMax_, aim.battlePlayer.mpMax_); } } if (aim.ControlEntity.PlayerInfoUI != null) { Roleui ro = aim.ControlEntity.PlayerInfoUI.GetComponent <Roleui>(); if (null == ro) { return; } ro.ValueChange(PropertyType.PT_HpCurr, GamePlayer.Instance.GetIprop(PropertyType.PT_HpMax) * -1, GamePlayer.Instance.GetIprop(PropertyType.PT_HpMax), GamePlayer.Instance.GetIprop(PropertyType.PT_MpMax), false, false); } aim.ControlEntity.hitOver_ = false; aim.ControlEntity.DealEntityDie(); Wait4AimDie(); }, 0.7f); }, false, false, 0.3f, 0, false); }, 0.3f); }, 1f); }
public void Cast(int skillId, int skillLv, BattleActor caster, BattleActor[] aims, COM_ReportTarget[] propertyVals, FinishCallBack finCallback, AttackFinishCallBack attackfinishCallback = null, bool realAimPos = false) { GlobalInstanceFunction.Instance.openTimer_ = true; GlobalInstanceFunction.Instance.deadTimer_ = 0f; GlobalInstanceFunction.Instance.OnDeadFinish += OnDealDeadFinish; if (crt_data_ != null) { ClientLog.Instance.LogError("a skill is casting"); return; } effectInsts_ = new Dictionary <int, EffectInst> (); crt_data_ = SkillData.GetData(skillId, skillLv); if (crt_data_ == null) { ClientLog.Instance.LogError("skill id :" + skillId + "has not data"); return; } realAimPos_ = realAimPos; if (caster.InstId == GamePlayer.Instance.InstId || TeamSystem.isTeamMember(caster.InstId)) { AttaclPanel.Instance.SetSkillIcon(skillId, skillLv, caster.AssetId); //caster.ControlEntity.PlayerInfoUI.GetComponent<Roleui>().ShowSkill(crt_data_.singEffectId_, caster.SkillNamePos()); } isPhysic_ = crt_data_._IsPhysic; if (isPhysic_) { if (caster.battlePlayer.weaponItemId_ != 0) { isMelee_ = !caster.rangeWeapon(); } else { isMelee_ = crt_data_._IsMelee; } } else { isMelee_ = crt_data_._IsMelee; } Transform t = Battle.Instance.GetStagePointByIndex(caster.BattlePos); if (t == null) { return; } caster_ = caster; aims_ = TrimNull(aims); props_ = propertyVals; originObj_ = t.gameObject; finish_call_back_ = finCallback; attack_finish_call_back_ = attackfinishCallback; //caster_.ResetPos(); Battle.Instance.ResetActorDirection(); aimsQue_ = new Queue <BattleActor>(); propQue_ = new Queue <COM_ReportTarget>(); for (int i = 0; i < aims_.Length; ++i) { if (aims_[i] == null) { continue; } aimsQue_.Enqueue(aims_[i]); propQue_.Enqueue(props_[i]); } if (isMelee_) { caster_.attackAnim_ = caster_.GetWeaponAction() + GlobalValue.TAttack; } else { if (isPhysic_) { caster_.castAnim_ = caster_.GetWeaponAction() + GlobalValue.TCast; } else { caster_.castAnim_ = GlobalValue.TCast; } } caster.battlePlayer.mpCrt_ -= crt_data_._Cost_mana; if (caster.InstId == GamePlayer.Instance.InstId) { AttaclPanel.Instance.ChangeValue(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, caster.battlePlayer.hpMax_, caster.battlePlayer.mpMax_); ScrollViewPanel.curMp = caster.battlePlayer.mpCrt_; } if (Battle.Instance.SelfActorBattleBaby != null) { if (caster.InstId == Battle.Instance.SelfActorBattleBaby.InstId) { AttaclPanel.Instance.ChangeValueBaby(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, caster.battlePlayer.hpMax_, caster.battlePlayer.mpMax_); } } if (caster.ControlEntity.PlayerInfoUI != null && caster.ControlEntity.PlayerInfoUI.GetComponent <Roleui>() != null) { Roleui roleinfoUI = caster.ControlEntity.PlayerInfoUI.GetComponent <Roleui>(); roleinfoUI.ValueChange(PropertyType.PT_MpCurr, crt_data_._Cost_mana * -1, caster.battlePlayer.hpMax_, caster.battlePlayer.mpMax_, false); } //EffectAPI.Load (() => { // if (crt_data_._Cast_effectID != -1) // EffectAPI.Play((EFFECT_ID)crt_data_._Cast_effectID, caster_.ControlEntity.ActorObj, null, null, AfterCastEffect); // else // AfterCastEffect(); //}, crt_data_._EffectID, crt_data_._Cast_effectID, crt_data_._Cast_effectID); if (crt_data_._Cast_effectID != -1) { EffectAPI.Play((EFFECT_ID)crt_data_._Cast_effectID, caster_.ControlEntity.ActorObj, null, null, AfterCastEffect); } else { AfterCastEffect(); } }