protected void OnClickFlyPoint(FlyPoint _flyPoint) { if (_flyPoint == null || target == null) { return; } target.GoNormal(); target.CurClickFlyPoint = _flyPoint; if (isDragingRockerItem) { return; } target.CancelCommands(); Command_MoveTo cmdMoveTo = new Command_MoveTo(); cmdMoveTo.destPos = _flyPoint.gameObject.transform.position; cmdMoveTo.maxDistance = 0f; target.commandMng.PushCommand(cmdMoveTo); //Command_FlyPoint cmdFly = new Command_FlyPoint(); //cmdFly.type = _flyPoint.RefData.id; //GameCenter.curMainPlayer.commandMng.PushCommand(cmdFly); }
public static void OnMainPlayerTriggerFlyPoint(MainPlayer _mainPlayer, FlyPoint _point) { if (_point == null || _mainPlayer == null || !_mainPlayer.hasCtrlAwake) { return; } if (_mainPlayer.Level < (ulong)_point.RefData.needLv) { GameCenter.messageMng.AddClientMsg(161); return; } _mainPlayer.curTrigerFlyPoint = _point; if (_point.RefData != null) { switch (_point.RefData.sort) { case FlyPointSort.openUI: break; case FlyPointSort.targetScene: GameCenter.mainPlayerMng.C2S_Fly(_point.RefData.id); break; case FlyPointSort.recall: GameCenter.mainPlayerMng.C2S_Fly(_point.RefData.id); break; default: break; } } }
public static FlyPoint CreateDummy(FlyPointRef _info) { GameObject newGO = new GameObject("Dummy FlyPoint[" + _info.id + "]"); newGO.tag = "FlyPoint"; FlyPoint flyPoint = newGO.AddComponent <FlyPoint>(); newGO.SetMaskLayer(LayerMask.NameToLayer("Static")); flyPoint.id = _info.id; flyPoint.refData = _info; flyPoint.isDummy_ = true; GameCenter.curGameStage.PlaceGameObjectFromStaticRef(flyPoint, (int)_info.sceneVector.x, (int)_info.sceneVector.z, _info.direction, (int)_info.sceneVector.y); GameCenter.curGameStage.AddObject(flyPoint); return(flyPoint); }
public override bool Exec(Actor _actor) { FlyPointRef flyPointRef = ConfigMng.Instance.GetFlyPointRef(type); if (flyPointRef == null) { GameSys.LogError("取不到传送点的配置信息!命令执行中断!"); return(true); } MainPlayer p = _actor as MainPlayer; if (p == null) { return(true); } FlyPoint fp = GameCenter.curGameStage.GetObject(ObjectType.FlyPoint, type) as FlyPoint; FlyPoint.OnMainPlayerTriggerFlyPoint(p, fp); return(true); }
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); }
protected void InitMap() { if (manName != null) { manName.text = GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneRef.name; } if (mapCtrl != null) { mapCtrl.localPosition = new Vector3(mapCtrlOriginPos.x - mainPlayer.curSector.c * Mathf.PI + mapFrameScale.x / 2.0f, mapCtrlOriginPos.y - mainPlayer.curSector.r * Mathf.PI + mapFrameScale.y / 2.0f, 0); } List <Monster> mobs = GameCenter.curGameStage.GetMobs(); for (int i = 0; i < mobs.Count; i++) { Monster instance = mobs[i]; if (mobPointDic.ContainsKey(instance.id) || instance.isDead) { continue; } GameObject myPoint = Instantiate(mobPointInstance) as GameObject; myPoint.transform.parent = mapCtrl; myPoint.transform.localScale = Vector3.one; myPoint.transform.localPosition = new Vector3(instance.curSector.c * Mathf.PI, instance.curSector.r * Mathf.PI, 0); SmartActorMapPoint p = myPoint.AddComponent <SmartActorMapPoint>(); p.SetTarget(instance); mobPointDic.Add(instance.id, myPoint); } List <NPC> npcs = GameCenter.curGameStage.GetNPCs(); for (int i = 0; i < npcs.Count; i++) { NPC instance = npcs[i]; if (npcPointDic.ContainsKey(instance.id)) { continue; } GameObject myPoint = Instantiate(npcPointInstance) as GameObject; myPoint.transform.parent = mapCtrl; myPoint.transform.localScale = Vector3.one; myPoint.transform.localPosition = new Vector3(instance.curSector.c * Mathf.PI, instance.curSector.r * Mathf.PI, 0); SmartActorMapPoint p = myPoint.AddComponent <SmartActorMapPoint>(); p.SetTarget(instance); npcPointDic.Add(instance.id, myPoint); } List <FlyPoint> flys = GameCenter.curGameStage.GetFlypoints(); for (int i = 0; i < flys.Count; i++) { FlyPoint instance = flys[i]; if (flyPointDic.ContainsKey(instance.id)) { continue; } GameObject myPoint = Instantiate(flyPointInstance) as GameObject; myPoint.transform.parent = mapCtrl; myPoint.transform.localScale = Vector3.one; myPoint.transform.localPosition = new Vector3(instance.curSector.c * Mathf.PI, instance.curSector.r * Mathf.PI, 0); flyPointDic.Add(instance.id, myPoint); } LimitMapCtr(); }