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); }
protected override void OnEnable() { if (IsEnabled) { actionTarget = GetTarget(); tracker = actionTarget.GetComponent <LocomotionTracker>(); if (tracker.SetCurrentController <RunController>()) { thisTransform = actionTarget.transform; raycastLayerMask = LayerConstants.GetPlayerLayerCollisionMask(); actorRadius = 0f; actorHalfHeight = 0.1f; CharacterController component = actionTarget.GetComponent <CharacterController>(); if (component != null) { actorRadius = component.radius; actorHalfHeight = component.height / 2f; } runController = actionTarget.GetComponent <RunController>(); base.OnEnable(); CoroutineRunner.Start(doMoveTo(), this, "doMoveTo"); } } else { CoroutineRunner.Start(completeAfterFrame(), this, "completeAfterFrame"); } }
private void jumpToRestartLocation() { GameObject localPlayerGameObject = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject; Vector3 raceRestartPosition = tubeRaceDefinition.RaceRestartPosition; RaceController component = localPlayerGameObject.GetComponent <RaceController>(); if (component != null) { component.setControlsEnabled(enabled: true); } LocomotionTracker component2 = localPlayerGameObject.GetComponent <LocomotionTracker>(); if (!component2.IsCurrentControllerOfType <RunController>()) { component2.SetCurrentController <RunController>(); } localPlayerGameObject.transform.position = raceRestartPosition; RaceGameController component3 = localPlayerGameObject.GetComponent <RaceGameController>(); if (component3 != null) { component3.RemoveLocalPlayerRaceData(); Object.Destroy(component3); } Service.Get <EventDispatcher>().DispatchEvent(new CinematographyEvents.CameraSnapLockEvent(snapPosition: false, snapAim: true)); CoroutineRunner.Start(LocomotionUtils.nudgePlayer(component2), component2.gameObject, "MoveAfterJump"); }
public void Awake() { agent = GetComponent <NavMeshAgent>(); tracker = GetComponent <LocomotionTracker>(); agent.updatePosition = false; agent.updateRotation = false; tracker.SetCurrentController <RunController>(); runController = GetComponent <RunController>(); runController.Behaviour.SetStyle(LocoStyle); }
private void TryExitSit() { if (!(bool)SceneRefs.ActionSequencer.GetTrigger(base.gameObject)) { tracker.SetCurrentController <RunController>(); if (exitingViaJump && tracker.GetCurrentController() is RunController && !IsUnderwater) { tracker.GetCurrentController().DoAction(LocomotionAction.Jump); } } }
public void ResetPlayer() { LocomotionTracker component = GetComponent <LocomotionTracker>(); if (component != null) { component.SetCurrentController <RunController>(); } base.transform.position = startingPosition; base.transform.rotation = startingRotation; Service.Get <EventDispatcher>().DispatchEvent(new OutOfBoundsWarperEvents.ResetPlayer(base.gameObject)); }
private void locomotionStateChanged(LocomotionState state) { switch (state) { case LocomotionState.Slide: if (receivingEnabled) { locomotionTracker.SetCurrentController <SlideController>(); break; } pendingSlide = true; pendingRun = false; break; case LocomotionState.Racing: if (receivingEnabled) { if (playerDataHandle.IsLocalPlayer) { locomotionTracker.SetCurrentController <RaceController>(); } else if (LocomotionHelper.IsCurrentControllerOfType <SlideController>(base.gameObject)) { locomotionTracker.SetCurrentController <RaceController>(); } else { locomotionTracker.SetCurrentController <SlideController>(); } } else { pendingSlide = true; pendingRun = false; } break; case LocomotionState.Default: if (receivingEnabled) { locomotionTracker.SetCurrentController <RunController>(); break; } pendingSlide = false; pendingRun = true; break; default: pendingSlide = false; pendingRun = false; break; } }
private void onViewReady(AvatarBaseAsync view) { if (locomotionData == null) { return; } LocomotionTracker component = GetComponent <LocomotionTracker>(); switch (locomotionData.LocoState) { case LocomotionState.Slide: if (component.IsCurrentControllerOfType <SlideController>()) { GetComponent <Animator>().SetBool(AnimationHashes.Params.Slide, value: true); GetComponent <Animator>().Play(AnimationHashes.States.Slide.Enter, 0); } else { component.SetCurrentController <SlideController>(); } break; case LocomotionState.Sitting: { if (!component.IsCurrentControllerOfType <SitController>()) { component.SetCurrentController <SitController>(); } SitController sitController = component.GetCurrentController() as SitController; if (sitController != null) { sitController.RemoteSit(null); } break; } } }
private void OnLocomotionBroadcasterDoAction(LocomotionController.LocomotionAction action, object userData = null) { if (!(Prop != null)) { return; } switch (action) { case LocomotionController.LocomotionAction.Action1: case LocomotionController.LocomotionAction.Action2: case LocomotionController.LocomotionAction.Action3: locomotionTracker.SetCurrentController <RunController>(); if (Prop.PropDef.PropType == PropDefinition.PropTypes.InteractiveObject && Prop.IsOwnerLocalPlayer) { Service.Get <ICPSwrveService>().Action("game.interactive_object", Prop.PropDef.name, action.ToString()); } break; } }
private IEnumerator setPositionToSpawnPointWaitAFrame(SpawnPointSelector spawner) { base.transform.position = spawner.SelectSpawnPosition(CoordinateSpace.World); base.transform.rotation = spawner.SelectSpawnRotation(CoordinateSpace.World); yield return(null); LocomotionTracker tracker = ClubPenguin.SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponent <LocomotionTracker>(); if (tracker != null) { tracker.SetCurrentController <RunController>(); } base.transform.position = spawner.SelectSpawnPosition(CoordinateSpace.World); base.transform.rotation = spawner.SelectSpawnRotation(CoordinateSpace.World); yield return(null); LocomotionActionEvent movement = default(LocomotionActionEvent); movement.Type = LocomotionAction.Move; movement.Position = base.transform.position; movement.Direction = Vector3.zero; sendNetworkMessage(movement); }
public void SpawnPlayer(SpawnPlayerParams spawnPlayerParams) { if (spawnPlayerParams.Zone != null || !string.IsNullOrEmpty(spawnPlayerParams.SceneName)) { bool flag = false; PresenceData component = dataEntityCollection.GetComponent <PresenceData>(dataEntityCollection.LocalPlayerHandle); ZoneTransitionService zoneTransitionService = Service.Get <ZoneTransitionService>(); if (spawnPlayerParams.Zone != null) { ZoneDefinition zoneBySceneName = zoneTransitionService.GetZoneBySceneName(component.Room); flag = (zoneBySceneName != null && string.Equals(spawnPlayerParams.Zone.ZoneName, zoneBySceneName.ZoneName)); } else if (!string.IsNullOrEmpty(spawnPlayerParams.SceneName)) { flag = ((!zoneTransitionService.IsInIgloo) ? string.Equals(component.Room, spawnPlayerParams.SceneName) : string.Equals(zoneTransitionService.CurrentZone.SceneName, spawnPlayerParams.SceneName)); } if (!flag) { if (!dataEntityCollection.TryGetComponent(dataEntityCollection.LocalPlayerHandle, out SpawnData component2)) { component2 = dataEntityCollection.AddComponent <SpawnData>(dataEntityCollection.LocalPlayerHandle); } if (spawnPlayerParams.SpawnedAction != null) { component2.SpawnedAction = spawnPlayerParams.SpawnedAction; } component2.Position = spawnPlayerParams.Position; component2.Rotation = spawnPlayerParams.Rotation; component2.PendingReward = spawnPlayerParams.PendingReward; if (spawnPlayerParams.Zone != null) { zoneTransitionService.LoadZone(spawnPlayerParams.Zone, "Loading"); } else { zoneTransitionService.LoadZone(spawnPlayerParams.SceneName, "Loading"); } return; } } if (spawnPlayerParams.PendingReward != null) { Service.Get <EventDispatcher>().DispatchEvent(new RewardServiceEvents.MyRewardEarned(RewardSource.QUICK_NOTIFICATION, "", spawnPlayerParams.PendingReward)); } if (Vector3.Distance(base.transform.position, spawnPlayerParams.Position) <= 3f) { if (spawnPlayerParams.SpawnedAction != null) { executeSpawedAction(spawnPlayerParams.SpawnedAction); } return; } LocomotionTracker component3 = base.gameObject.GetComponent <LocomotionTracker>(); if (component3.IsCurrentControllerOfType <SlideController>()) { component3.SetCurrentController <RunController>(); } else if (spawnPlayerParams.GetOutOfSwimming && component3.IsCurrentControllerOfType <SwimController>()) { Animator component4 = base.gameObject.GetComponent <Animator>(); component4.SetTrigger(AnimationHashes.Params.SwimToWalk); component3.SetCurrentController <RunController>(); } Vector3 zero = Vector3.zero; if (spawnPlayerParams.NudgePlayer && component3.IsCurrentControllerOfType <RunController>()) { zero.y = 0.5f; } base.transform.position = spawnPlayerParams.Position + zero; ClubPenguin.Core.SceneRefs.Get <BaseCamera>().Snap(); if (spawnPlayerParams.NudgePlayer) { actionOnSpawned = spawnPlayerParams.SpawnedAction; CoroutineRunner.Start(LocomotionUtils.nudgePlayer(component3, onNudgePlayerDone), component3.gameObject, "MoveAfterJump"); } else if (spawnPlayerParams.SpawnedAction != null) { executeSpawedAction(spawnPlayerParams.SpawnedAction); } }