private void OnSceneFightLose() { int nHeroCount = SceneObjectManager.GetInstance().GetObjectHeroCount(); for (int i = 0; i < nHeroCount; ++i) { ObjectHero HeroObj = SceneObjectManager.GetInstance().GetHeroObject(i); if (HeroObj != null && HeroObj.IsAlive()) { NavMeshAgent Nav = HeroObj.GetNavMesh(); Nav.SetDestination(HeroObj.GetGameObject().transform.position); HeroObj.GetAnimation().Anim_Fidle(false); } } if (ObjectSelf.GetInstance().LimitFightMgr.m_bStartEnter) { ObjectSelf.GetInstance().LimitFightMgr.SendRoundOver(); } else { if (ObjectSelf.GetInstance().WorldBossMgr.m_bStartEnter) { ObjectSelf.GetInstance().WorldBossMgr.SendRoundOver(); } else { CEndBattle battle = new CEndBattle(); battle.pass = 0;// 未通过 IOControler.GetInstance().SendProtocol(battle); } } GameTimeControler.Inst.SetState(TimeScaleState.TimeScale_Normal); }
/// <summary> /// 每击杀一波敌人后,我方奖励怒气 [3/3/2015 Zmy] /// </summary> private void EachRewardPower() { // 奖励怒气 = 主角等级影响 + 英雄等级影响 + 装备符文等其他能增加英雄属性系统影响 + config中配置的全局变量 + 地图奖励 [3/3/2015 Zmy] //int nSelf_value = ObjectSelf.GetInstance().GetWavaPowerValue(); int nHero_value = 0; for (int i = 0; i < SceneObjectManager.GetInstance().GetObjectHeroCount(); i++) { ObjectHero pHero = SceneObjectManager.GetInstance().GetHeroObject(i); if (pHero == null || pHero.IsAlive() == false) { continue; } // int nCurLevel = pHero.GetHeroData().Level; // int nInitFuryTemplateID = pHero.GetHeroRow().getWaveFury() - 1; // // HerofuryTemplate pRow = (HerofuryTemplate)DataTemplate.GetInstance().m_HeroFuryTable.getTableData(nCurLevel); // if (nInitFuryTemplateID >= 0 && nInitFuryTemplateID < GlobalMembers.MAX_HEROFURY_PARAM_COUNT) // { // nHero_value += pRow.getTemplate()[nInitFuryTemplateID]; // } AngertableTemplate _data = (AngertableTemplate)DataTemplate.GetInstance().m_AngerTable.getTableData(pHero.GetHeroRow().getFuryId()); nHero_value += _data.getWaveFury(); } //int nGlobalWavaFury = DataTemplate.GetInstance().m_GameConfig.getWave_fury(); //int nSum = nSelf_value + nHero_value + nGlobalWavaFury; m_HeroPower.OnUpdatePowerValue(nHero_value); }
private void UpdateHeroBoarding() { moveTime += Time.deltaTime; if (moveTime < 0.1f) { return; } moveTime = 0f; int nHeroCount = SceneObjectManager.GetInstance().GetObjectHeroCount(); for (int i = 0; i < nHeroCount; i++) { ObjectHero HeroObj = SceneObjectManager.GetInstance().GetHeroObject(i); if (HeroObj != null && HeroObj.IsAlive()) { NavMeshAgent Nav = HeroObj.GetNavMesh(); Nav.speed = HeroObj.GetMoveSpeed(); Nav.SetDestination(FightEditorContrler.GetInstantiate().GetFormationPos(HeroObj)); //HeroObj.SetWorldPosRotation(FightEditorContrler.GetInstantiate().GetFormationPos(HeroObj), FightEditorContrler.GetInstantiate().GetFormationAngle(HeroObj)); HeroObj.SetObjectActionState(ObjectCreature.ObjectActionState.boarding); HeroObj.GetAnimation().Anim_Fidle(false); } } }
//英雄瞬间移动结束慢慢出现 private void UpdateMomentMoveExit() { int nHeroCount = SceneObjectManager.GetInstance().GetObjectHeroCount(); for (int i = 0; i < nHeroCount; ++i) { ObjectHero HeroObj = SceneObjectManager.GetInstance().GetHeroObject(i); if (HeroObj != null && HeroObj.IsAlive()) { //..慢慢出现 m_ShowCount++; } } if (m_ShowCount == SceneObjectManager.GetInstance().GetObjectHeroCount()) { m_ShowCount = 0; FightEditorContrler.GetInstantiate().HeroPathNormalMove(); SetFightState(FightState.HeroMove); for (int i = 0; i < nHeroCount; ++i) { ObjectHero HeroObj = SceneObjectManager.GetInstance().GetHeroObject(i); if (HeroObj != null && HeroObj.IsAlive()) { HeroObj.GetNavMesh().enabled = true; HeroObj.SetObjectActionState(ObjectCreature.ObjectActionState.forward); } } } }
//瞬间移动事件进入 public void CallBack_eroPathMomentMoveEnter() { SetFightState(FightState.HeroMonmentMoveEnter); int nHeroCount = SceneObjectManager.GetInstance().GetObjectHeroCount(); for (int i = 0; i < nHeroCount; ++i) { ObjectHero HeroObj = SceneObjectManager.GetInstance().GetHeroObject(i); if (HeroObj != null && HeroObj.IsAlive()) { HeroObj.GetAnimation().Anim_Run(); NavMeshAgent Nav = HeroObj.GetNavMesh(); Nav.speed = HeroObj.GetMoveSpeed(); Nav.SetDestination(FightEditorContrler.GetInstantiate().GetFormationPos(HeroObj)); //Debug.Log(FightEditorContrler.GetInstantiate().GetFormationPos(HeroObj)); StartCoroutine(DelayCallPos(FightEditorContrler.GetInstantiate().GetFormationPos(HeroObj), HeroObj.GetGameObject(), HeroObj, CallBack_MomentMoveEnter)); } } }
private void CallBack_PrepareBoard() { SetFightState(FightState.PrepareBoard); int nHeroCount = SceneObjectManager.GetInstance().GetObjectHeroCount(); for (int i = 0; i < nHeroCount; ++i) { ObjectHero HeroObj = SceneObjectManager.GetInstance().GetHeroObject(i); if (HeroObj != null && HeroObj.IsAlive()) { HeroObj.GetAnimation().Anim_Run(); NavMeshAgent Nav = HeroObj.GetNavMesh(); Nav.speed = HeroObj.GetMoveSpeed(); Nav.SetDestination(FightEditorContrler.GetInstantiate().GetFormationPos(HeroObj)); StartCoroutine(DelayCall(Nav, HeroObj.GetGameObject(), HeroObj, CallBack_PrepareBoardPos)); } } }
//进入战斗状态开始战斗,在这之前先修正一下人物位置 [1/20/2015 Zmy] private void CallBack_EnterFightState() { int nHeroCount = SceneObjectManager.GetInstance().GetObjectHeroCount(); for (int i = 0; i < nHeroCount; ++i) { // ObjectHero HeroObj = SceneObjectManager.GetInstance().GetHeroObject(i); // if (HeroObj != null) // { // GameObject obj = HeroObj.GetGameObject(); // if (obj != null) // { // obj.GetComponent<NavMeshAgent>().Stop(); // float _heroSpeed = HeroObj.GetMoveSpeed(); // float _moveTime = Vector3.Distance(obj.transform.position, FightEditorContrler.inst.GetFormationPos(HeroObj.GetGameObject())) / _heroSpeed; // //修正高度值 [1/22/2015 Zmy] // Vector3 targetPos = new Vector3(FightEditorContrler.inst.GetFormationPos(HeroObj.GetGameObject()).x, obj.transform.position.y, FightEditorContrler.inst.GetFormationPos(HeroObj.GetGameObject()).z); // obj.transform.DOMove(targetPos, _moveTime).SetUpdate(true).SetEase(Ease.Linear).OnComplete(()=>CallBack_RevisepPos(obj,HeroObj)); // } // } ObjectHero HeroObj = SceneObjectManager.GetInstance().GetHeroObject(i); if (HeroObj != null && HeroObj.IsAlive()) { HeroObj.GetAnimation().Anim_Run(); NavMeshAgent Nav = HeroObj.GetNavMesh(); Nav.speed = HeroObj.GetMoveSpeed(); Nav.SetDestination(FightEditorContrler.GetInstantiate().GetFormationPos(HeroObj)); StartCoroutine(DelayCall(Nav, HeroObj.GetGameObject(), HeroObj, CallBack_RevisepPos)); } } //切换准备战斗状态 SetFightState(FightState.prepareFight); //重算一下移动位置偏移量; HeroPathtContrler.GetInstantiate().ResetMoveTargetOffset(); }
//英雄慢慢消失后瞬间移动 private void UpdateMomentMoveIng() { int nHeroCount = SceneObjectManager.GetInstance().GetObjectHeroCount(); for (int i = 0; i < nHeroCount; ++i) { ObjectHero HeroObj = SceneObjectManager.GetInstance().GetHeroObject(i); if (HeroObj != null && HeroObj.IsAlive()) { //..慢慢消失 m_DisappearCount++; HeroObj.GetNavMesh().enabled = false; HeroObj.OnConcealThis(); } } if (m_DisappearCount == SceneObjectManager.GetInstance().GetObjectHeroCount()) { m_DisappearCount = 0; FightEditorContrler.GetInstantiate().HeroPathNormalMove(); SetFightState(FightState.HeroMonmentMoveEnter); } }
//移动中更新obj位置 [1/20/2015 Zmy] private void UpdateHeroForward() { moveTime += Time.deltaTime; if (moveTime < 0.1f) { //控制刷新延迟 [1/21/2015 Zmy] return; } moveTime = 0.0f; int nHeroCount = SceneObjectManager.GetInstance().GetObjectHeroCount(); for (int i = 0; i < nHeroCount; ++i) { ObjectHero HeroObj = SceneObjectManager.GetInstance().GetHeroObject(i); if (HeroObj != null && HeroObj.IsAlive()) { NavMeshAgent Nav = HeroObj.GetNavMesh(); Nav.speed = HeroObj.GetMoveSpeed(); Nav.SetDestination(FightEditorContrler.GetInstantiate().GetFormationPos(HeroObj)); HeroObj.SetObjectActionState(ObjectCreature.ObjectActionState.forward); } } }