public override bool Exec(Actor _actor) { if (target == null) { return(true); } if (target.isDummy) { return(false); } if (GameCenter.curGameStage == null || !GameCenter.sceneMng.EnterSucceed) { return(false); } Vector3 targetPos = target.transform.position; Vector3 diff = _actor.transform.position - targetPos; if (diff.sqrMagnitude <= minDistance * minDistance) { target.InteractionSound(); switch (target.typeID) { case ObjectType.NPC: NPC npc = target as NPC; GameCenter.curMainPlayer.CurTarget = npc; //if(!GameCenter.taskMng.IsOpenDialog) GameCenter.uIMng.SwitchToUI(GUIType.NPCDIALOGUE); //GameCenter.taskMng.SetNPCDialogActive(false); break; case ObjectType.FlyPoint: FlyPoint fly = target as FlyPoint; MainPlayer mp = _actor as MainPlayer; if (mp != null && fly != null) { mp.CancelCommands(); Command_MoveTo cmdMoveTo = new Command_MoveTo(); cmdMoveTo.destPos = fly.gameObject.transform.position; cmdMoveTo.maxDistance = 0f; mp.commandMng.PushCommand(cmdMoveTo); //Command_FlyPoint cmdFly = new Command_FlyPoint(); //cmdFly.type = fly.RefData.id; //GameCenter.curMainPlayer.commandMng.PushCommand(cmdFly); } break; case ObjectType.SceneItem: SceneItem sceneitem = target as SceneItem; if (sceneitem != null && sceneitem.IsTouchType == TouchType.TOUCH) { if (GameCenter.mainPlayerMng.MainPlayerInfo.CurMountInfo != null && GameCenter.mainPlayerMng.MainPlayerInfo.CurMountInfo.IsRiding) //下坐骑 { GameCenter.newMountMng.C2S_ReqRideMount(ChangeMount.DOWNRIDE, GameCenter.mainPlayerMng.MainPlayerInfo.CurMountInfo.ConfigID, MountReqRideType.AUTO); } } break; } return(true); } return(false); }
void Update() { //if (!fsm.SceneAnimStage.IsWatching) //{ if (!UIMng.isClosingWnd && !UICamera.isOverUI && !hasKeyboardMoving)//解决主界面点击穿透的BUG by 易睿 { if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) { TouchPoint(); } else { MousePoint(); } } else { pointDatas = null; UIMng.isClosingWnd = false; } //} //else //{ //} doPointDatas(); if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) { //Debug.Log("进入省电模式的判断"); if (Input.touchCount > 0) { time = SystemSettingMng.POWERSAVING_TIME + (int)Time.time; if (GameCenter.systemSettingMng.OnPowerSavingEvent != null) { GameCenter.systemSettingMng.OnPowerSavingEvent(); } } } else { if (Input.anyKeyDown) { time = SystemSettingMng.POWERSAVING_TIME + (int)Time.time; if (GameCenter.systemSettingMng.OnPowerSavingEvent != null) { GameCenter.systemSettingMng.OnPowerSavingEvent(); } } } if (time - (int)Time.time < SystemSettingMng.POWERSAVING_TIME && time - (int)Time.time >= 0) { if (lastTime != (int)Time.time) { int showTime; showTime = time - (int)Time.time; int curTime = showTime % SystemSettingMng.POWERSAVING_TIME; if (curTime == 0) { if (!GameCenter.systemSettingMng.IsPowerSaving) { //GameCenter.uIMng.SwitchToUI(GUIType.NONE); //Debug.Log("进入省电模式"); GameCenter.uIMng.GenGUI(GUIType.POWERSAVING, true); } } } } lastTime = (int)Time.time; //if (Input.acceleration.x > 0 || Input.acceleration.y > 0 || Input.acceleration.z > 0) //{ // NGUIDebug.Log("重力加速度 x =" + Input.acceleration.x + " , y = " + Input.acceleration.y + " , z = " + Input.acceleration.z); // if (!target.isRigidity && !target.IsProtecting) // { // target.Jump(); // } //} //if (Input.gyro.gravity.sqrMagnitude > 0) //{ // NGUIDebug.Log("陀螺仪重力加速度 = " + Input.gyro.gravity); // if (!target.isRigidity && !target.IsProtecting) // { // target.Jump(); // } //} if (GameCenter.instance.isDevelopmentPattern) { if (Input.GetKeyDown(KeyCode.B)) //影响键盘输入 注释掉 { //target.AbilityTest(); } //测试用 by吴江 //if ( Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.Z)) //影响键盘输入 注释掉 //{ // target.BuffTest(1, true); //} //if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.X)) //影响键盘输入 注释掉 //{ // target.BuffTest(33,true); //} //if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.C)) //影响键盘输入 注释掉 //{ // target.BuffTest(34, true); //} //if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.V)) //影响键盘输入 注释掉 //{ // target.BuffTest(36, true); //} //if (Input.GetKey(KeyCode.LeftAlt) && Input.GetKeyDown(KeyCode.Z)) //影响键盘输入 注释掉 //{ // target.BuffTest(1, false); //} //if (Input.GetKey(KeyCode.LeftAlt) && Input.GetKeyDown(KeyCode.X)) //影响键盘输入 注释掉 //{ // target.BuffTest(33, false); //} //if (Input.GetKey(KeyCode.LeftAlt) && Input.GetKeyDown(KeyCode.C)) //影响键盘输入 注释掉 //{ // target.BuffTest(34, false); //} //if (Input.GetKey(KeyCode.LeftAlt) && Input.GetKeyDown(KeyCode.V)) //影响键盘输入 注释掉 //{ // target.BuffTest(36, false); //} //if (Input.GetKey(KeyCode.I))//测试 试炼场 by龙英杰 //{ // GameCenter.uIMng.SwitchToUI(GUIType.WILDBOSS); //} //if (Input.GetKey(KeyCode.P))//测试每日活动LZR //{ // // GameCenter.uIMng.SwitchToUI(GUIType.DailyActivity); // GameCenter.uIMng.SwitchToUI(GUIType.RANDCHEST); //} if (Input.GetKey(KeyCode.O))//测试每日活动LZR { // GameCenter.uIMng.SwitchToUI(GUIType.CAMPJOIN); // GameCenter.uIMng.SwitchToUI(GUIType.MAILBOX); } if (Input.GetKeyDown(KeyCode.H)) { // GameCenter.sceneAnimMng.PushSceneAnima(GameCenter.instance.cur_Text_SceneAnima_ID); } //if(Input.GetKeyDown(KeyCode.Alpha1)) //{ // SkillWnd wnd = GameCenter.uIMng.GetGui<SkillWnd>(); // if (wnd != null) // { // wnd.OnClickSkillBtnActon(0); // } //} //else if (Input.GetKeyDown(KeyCode.Alpha2)) //{ // SkillWnd wnd = GameCenter.uIMng.GetGui<SkillWnd>(); // if (wnd != null) // { // wnd.OnClickSkillBtnActon(1); // } //} //else if (Input.GetKeyDown(KeyCode.Alpha3)) //{ // SkillWnd wnd = GameCenter.uIMng.GetGui<SkillWnd>(); // if (wnd != null) // { // wnd.OnClickSkillBtnActon(2); // } //} //else if (Input.GetKeyDown(KeyCode.Alpha4)) //{ // SkillWnd wnd = GameCenter.uIMng.GetGui<SkillWnd>(); // if (wnd != null) // { // wnd.OnClickSkillBtnActon(3); // } //} if (Input.GetKeyDown(KeyCode.Tab)) { GameCenter.curMainPlayer.ChangeTarget(); } if (Input.GetKeyDown(KeyCode.H)) { //GameCenter.uIMng.SwitchToUI(GUIType.CAMPMAIN); //GameCenter.campMng.C2S_AskCampActivity(CampAction.ACTIVITY); // GameCenter.mainPlayerMng.protectMinerMng.FinalData = new FinalSettlemenInfo(); //GameCenter.uIMng.SwitchToUI(GUIType.MAILBOX); } //if (Input.GetKey(KeyCode.L)) //{ // GameCenter.chapterRewardMng.Set(); //} if (Input.GetKey(KeyCode.Space)) { target.Jump(); } if (!isDragingRockerItem) { hasKeyboardMoving = Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.A); if (hasKeyboardMoving) { Vector3 vWS = Vector3.zero; Vector3 vAD = Vector3.zero; Transform mainCamTrasform = GameCenter.cameraMng.mainCamera.transform; if (Input.GetKey(KeyCode.W)) { vWS += mainCamTrasform.forward; } if (Input.GetKey(KeyCode.S)) { vWS -= mainCamTrasform.forward; } if (Input.GetKey(KeyCode.D)) { vAD += mainCamTrasform.right; } if (Input.GetKey(KeyCode.A)) { vAD -= mainCamTrasform.right; } if (!target.isRigidity) { target.CancelAbility(true); } target.AttakType = MainPlayer.AttackType.NONE; target.CancelCommands(); Vector3 dir = vWS + vAD; dir.y = 0.0f; dir.Normalize(); if (dir == Vector3.zero) { target.StopMovingTowards(); } else { target.MoveTowards(dir); } } else if (target.isMovingTowards) { target.StopMovingTowards(); } } } }