/// <summary> /// 英雄阵型进入待机 /// </summary> public void SetHeroPathIdle() { if (Heropathtype != HeroPathMoveType.Idle) { Heropathtype = HeroPathMoveType.Idle; HeroPathAnim.Pause(); } }
/// <summary> /// 英雄阵型战斗进入状态结束 /// </summary> public void SetHeroPathFightEnterEnd() { if (Heropathtype != HeroPathMoveType.FightEnterEnd) { Heropathtype = HeroPathMoveType.FightEnterEnd; //SetFormationMonmetMove(); //HeroPathAnim.Pause(); } }
/// <summary> /// 英雄阵型瞬间移动中 /// </summary> public void SetHeroPathMomentMoveIng() { if (Heropathtype != HeroPathMoveType.MonentMoveIng) { Heropathtype = HeroPathMoveType.MonentMoveIng; HeroPathAnim.Play(); SetFormationMonmetMove(); } }
/// <summary> /// 英雄阵型进入正常移动 /// </summary> public void SetHeroPathNormalMove() { if (Heropathtype != HeroPathMoveType.NormalMove) { Heropathtype = HeroPathMoveType.NormalMove; HeroPathAnim.Play(); SetFormationSpeed(MoveSpeed); } }
/// <summary> /// 英雄阵型进入瞬间移动 /// </summary> public void SetHeroPathMomentMoveEnter(int i) { if (Heropathtype != HeroPathMoveType.MomentMoveEnter) { Heropathtype = HeroPathMoveType.MomentMoveEnter; HeroPath.IsMonmentMove = true; HeroPathAnim.animationObject.transform.position = HeroPath.GetPathPosition(HeroPath.GetPathPercentage(i), true); HeroPathAnim.animationObject.transform.rotation = HeroPathAnim.GetAnimatedOrientation(HeroPath.GetPathPercentage(i), true); HeroPathAnim.percentage = HeroPath.GetPathPercentage(i); HeroPathAnim.Pause(); mMomentMoveIdx = i; } }
/// <summary> /// 英雄阵型状态进入准备整队状态 /// </summary> public void SetHeroPathLineUpReady() { if (Heropathtype == HeroPathMoveType.NormalMove) { return; } else if (Heropathtype != HeroPathMoveType.LineUpReady) { Heropathtype = HeroPathMoveType.LineUpReady; SetFormationSpeed(0); HeroPathAnim.Pause(); //HeroPathAnim.isPlaying = false; } }
/// <summary> /// 英雄阵型进入战斗状态 /// </summary> /// <param name="i">第几波怪物</param> public void SetHeroPathFightEnter(int i) { if (Heropathtype != HeroPathMoveType.FightEnter) { Heropathtype = HeroPathMoveType.FightEnter; FightCenterAngleUpdate(i); HeroPathAnim.Play(); SetFormationSpeed(MoveSpeed); if (!mInitFightEulerAngleDone) { mInitFightEulerAngleDone = true; mInitFightCamEulerAngle = FightCenter.transform.eulerAngles - HerosCenter.transform.eulerAngles; } } }
/// <summary> /// 动态初始化 /// </summary> /// <param name="data">英雄阵型序列化数据</param> /// <param name="XmlName">Xml地址</param> /// <param name="type">英雄阵型</param> /// <param name="speed">初始移动速度</param> public void Init(HeroPathDataObj data, HeroFormationType type, string PathXml) { //添加轨迹组件 动画组件 读取轨迹数据 HeroPathdata = data; HeroPath = this.gameObject.AddComponent <CameraPath>(); HeroPathAnim = this.gameObject.AddComponent <CameraPathAnimator>(); HeroPath.FromXML(PathXml); HeroPath.hermiteTension = data.Tension; //初始话战斗中心点和英雄中心点 FightCenter = new GameObject("FightCenter"); FightCenter.transform.parent = this.transform; FightCenter.transform.position = data.InitPos; HerosCenter = new GameObject("HerosCenter"); HerosCenter.transform.parent = this.transform; HerosCenter.transform.position = data.InitPos; //初始化战斗摄像机 整队摄像机 FightFollowCam = new GameObject("FightFollowCam"); FightFollowCam.transform.parent = FightCenter.transform; FightFollowCam.transform.localPosition = data.FightFollowCamPos; FightDefaultCam = new GameObject("FightDefaultCam"); FightDefaultCam.transform.SetParent(FightCenter.transform); FightDefaultCam.transform.localPosition = data.FightDefaultCamPos; LineUpFollowCam = new GameObject("LineUpFollowCam"); LineUpFollowCam.transform.parent = HerosCenter.transform; LineUpFollowCam.transform.localPosition = data.LineUpFollowCamPos; //初始化队伍阵型 GameObject objType = AssetLoader.Inst.GetAssetRes(type.ToString()); FormationCenterObj = Instantiate(objType, data.InitPos, data.InitAngles) as GameObject; HeroFormationtype = type; // FormationCenterObj.transform.parent = this.transform; FormationList = new List <GameObject>(); for (int i = 0; i < FormationCenterObj.transform.childCount; i++) { FormationList.Add(FormationCenterObj.transform.GetChild(i).gameObject); //Debug.Log(FormationCenterObj.transform.GetChild(i).position); } FormationDic = new Dictionary <ObjectCreature, GameObject>(); //初始化轨迹组件信息 HeroPathAnim.animationObject = FormationCenterObj.transform; HeroPathAnim.pathSpeed = 0; Heropathtype = HeroPathMoveType.Null; HeroPathPause(); SetHeroPathIdle(); }
//本地初始化 private void init() { HeroPathAnim = this.transform.FindChild("HerosPath").GetComponent <CameraPathAnimator>(); HeroPath = this.transform.FindChild("HerosPath").GetComponent <CameraPath>(); //HeroPath.FromXML("Assets/CameraPath3/HerosPath.xml"); FightCenter = this.transform.FindChild("FightCenter").gameObject; HerosCenter = this.transform.FindChild("HerosCenter").gameObject; FormationCenterObj = this.transform.FindChild("FormationCenter").gameObject; FormationList = new List <GameObject>(); for (int i = 0; i < FormationCenterObj.transform.childCount; i++) { FormationList.Add(FormationCenterObj.transform.GetChild(i).gameObject); } Heropathtype = HeroPathMoveType.Null; HeroFormationtype = HeroFormationType.Formation133; HeroPathAnim.animationObject = FormationCenterObj.transform; HeroPathAnim.pathSpeed = MoveSpeed = this.GetComponent <HeroPathData>().MoveSpeed; HeroPathPause(); }
/// <summary> /// 英雄阵型退出瞬间移动 /// </summary> public void SetHeroPathMomentMoveExit() { if (Heropathtype != HeroPathMoveType.MomentMoveExit) { HeroPath.IsMonmentMove = false; if (mMomentMoveIdx == -1) { //Debug.LogError("地编事件中MomentMove开始和MomentMove结束不匹配"); } else { //HeroPath.GotoPoint(mMomentMoveIdx); //HeroPathAnim.percentage = 0f; HeroPathAnim.animationObject.transform.position = HeroPath.GetPathPosition(HeroPath.GetPathPercentage(mMomentMoveIdx), true); HeroPathAnim.animationObject.transform.rotation = HeroPathAnim.GetAnimatedOrientation(HeroPath.GetPathPercentage(mMomentMoveIdx), true); HeroPathAnim.percentage = HeroPath.GetPercentage(mMomentMoveIdx); Heropathtype = HeroPathMoveType.MomentMoveExit; HeroPathAnim.Pause(); mMomentMoveIdx = -1; } } }