private bool onFriendLocationReceived(FriendsServiceEvents.FriendLocationInRoomReceived evt) { eventChannel.RemoveListener <FriendsServiceEvents.FriendLocationInRoomReceived>(onFriendLocationReceived); eventChannel.RemoveListener <FriendsServiceEvents.FriendNotInRoom>(onFriendNotInRoom); Vector3 location = evt.Location; if (!(Vector3.Distance(SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.transform.position, location) <= 3f)) { LocomotionTracker component = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponent <LocomotionTracker>(); GameObjectReferenceData component2; if (component.IsCurrentControllerOfType <SlideController>()) { component.SetCurrentController <RunController>(); } else if (component.IsCurrentControllerOfType <SwimController>() && dataEntityCollection.TryGetComponent <GameObjectReferenceData>(Handle, out component2)) { LocomotionTracker component3 = component2.GameObject.GetComponent <LocomotionTracker>(); if (component3.IsCurrentControllerOfType <RunController>()) { Animator component4 = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponent <Animator>(); component4.SetTrigger(AnimationHashes.Params.SwimToWalk); component.SetCurrentController <RunController>(); } } if (component.IsCurrentControllerOfType <RunController>()) { location.y += 0.5f; } SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.transform.position = location; ClubPenguin.Core.SceneRefs.Get <BaseCamera>().Snap(); CoroutineRunner.Start(LocomotionUtils.nudgePlayer(component), component.gameObject, "MoveAfterJump"); } destroyAndCloseCellPhone(); return(false); }
private bool onFriendLocationReceived(FriendsServiceEvents.FriendLocationInRoomReceived evt) { dataEntityCollection.RemoveComponent <SpawnAtPlayerData>(dataEntityCollection.LocalPlayerHandle); Service.Get <EventDispatcher>().RemoveListener <FriendsServiceEvents.FriendLocationInRoomReceived>(onFriendLocationReceived); Service.Get <EventDispatcher>().RemoveListener <FriendsServiceEvents.FriendNotInRoom>(onFriendNotInRoom); if (!playerDataHandle.Handle.IsNull) { base.transform.position = evt.Location; LocomotionActionEvent action = default(LocomotionActionEvent); action.Type = LocomotionAction.Move; action.Position = base.transform.position; action.Direction = Vector3.zero; Service.Get <INetworkServicesManager>().PlayerActionService.LocomotionAction(action); BaseCamera baseCamera = ClubPenguin.Core.SceneRefs.Get <BaseCamera>(); if (baseCamera != null) { baseCamera.Snap(); } dataEntityCollection.RemoveComponent <SpawnAtPlayerData>(playerDataHandle.Handle); } return(false); }