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); } } } }
/// <summary> /// 准备上载具的位置修正; /// </summary> /// <param name="obj"></param> /// <param name="heroObj"></param> private void CallBack_PrepareBoardPos(GameObject obj, ObjectHero heroObj) { m_BoardHeroCount++; heroObj.SetObjectActionState(ObjectCreature.ObjectActionState.boarding); if (m_BoardHeroCount >= SceneObjectManager.GetInstance().GetObjectHeroCount()) { m_BoardHeroCount = 0; SetFightState(FightState.PrepareBoardOver); } }
//瞬间移动进入前位置修正 private void CallBack_MomentMoveEnter(GameObject obj, ObjectHero heroObj) { m_MonmentMoveHeroPosCount++; heroObj.SetObjectActionState(ObjectCreature.ObjectActionState.monmentmoveIng); //heroObj.GetAnimation().Anim_Fidle(false); if (m_MonmentMoveHeroPosCount == SceneObjectManager.GetInstance().GetObjectHeroCount()) { m_MonmentMoveHeroPosCount = 0; SetFightState(FightState.HeroMonmentMoveIng); } }
/// <summary> /// 修正位置的回调 /// </summary> private void CallBack_RevisepPos(GameObject obj, ObjectHero heroObj) { m_ReviseHeroPosCount++; SetFightState(FightState.Fighting); heroObj.SetObjectActionState(ObjectCreature.ObjectActionState.scanning); if (m_ReviseHeroPosCount == 1) { GameEventDispatcher.Inst.dispatchEvent(GameEventID.SE_StopMonsterBirth); } if (m_ReviseHeroPosCount == SceneObjectManager.GetInstance().GetObjectHeroCount()) { m_ReviseHeroPosCount = 0; m_IsTriger = true; } //TODO::修正所有怪物状态为攻击状态---(先这么写以后待细细考虑); SceneObjectManager.GetInstance().ObjectMonsterAllAttack(); }
//移动中更新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); } } }