protected override void Update() { LocomotionTracker component = GetTarget().GetComponent <LocomotionTracker>(); if (component == null) { Completed(null, conditionBranchValue: false); } else if (Sitting && component.IsCurrentControllerOfType <SitController>()) { Completed(); } else if (Tubing && component.IsCurrentControllerOfType <SlideController>()) { Completed(); } else if (Swimming && component.IsCurrentControllerOfType <SwimController>()) { Completed(); } else if (Running && component.IsCurrentControllerOfType <RunController>()) { Completed(); } else { Completed(null, conditionBranchValue: false); } }
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 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"); }
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 bool isInteractingWithZiplineActionGraph(GameObject player) { if (player.IsDestroyed()) { return(false); } LocomotionTracker component = player.GetComponent <LocomotionTracker>(); if (component == null) { return(false); } if (component.IsCurrentControllerOfType <ZiplineController>()) { return(true); } GameObject trigger = ClubPenguin.SceneRefs.ActionSequencer.GetTrigger(player); if (trigger == null) { return(false); } return(trigger.GetComponent <SetZiplineLocomotionAction>() != null); }
private IEnumerator SampleSurface() { while (true) { if (base.isActiveAndEnabled) { Vector3 hitPoint = Vector3.zero; int num = LocomotionUtils.SampleSurface(base.transform, SurfaceSamplingData, out hitPoint); AnimatorStateInfo animatorStateInfo = LocomotionUtils.GetAnimatorStateInfo(anim); if (LocomotionUtils.IsLocomoting(animatorStateInfo)) { if (LocomotionUtils.IsWalking(animatorStateInfo)) { if (locoStatus != LocomotionStatus.Walking || num != prevSurfaceTypeIndex) { locoStatus = LocomotionStatus.Walking; if (num >= 0) { if (!string.IsNullOrEmpty(SurfaceSamplingData.Effects[num].WalkSwitch.SwitchValue)) { EventManager.Instance.PostEvent(SurfaceSamplingData.Effects[num].WalkSwitch.EventName, EventAction.SetSwitch, SurfaceSamplingData.Effects[num].WalkSwitch.SwitchValue, base.gameObject); } } else if (!string.IsNullOrEmpty(SurfaceSamplingData.DefaultWalkSwitch.EventName)) { EventManager.Instance.PostEvent(SurfaceSamplingData.DefaultWalkSwitch.EventName, EventAction.SetSwitch, SurfaceSamplingData.DefaultWalkSwitch.SwitchValue, base.gameObject); } } } else if (locoStatus != LocomotionStatus.Jogging || num != prevSurfaceTypeIndex) { locoStatus = LocomotionStatus.Jogging; if (num >= 0) { if (!string.IsNullOrEmpty(SurfaceSamplingData.Effects[num].JogSwitch.SwitchValue)) { EventManager.Instance.PostEvent(SurfaceSamplingData.Effects[num].JogSwitch.EventName, EventAction.SetSwitch, SurfaceSamplingData.Effects[num].JogSwitch.SwitchValue, base.gameObject); } } else if (!string.IsNullOrEmpty(SurfaceSamplingData.DefaultJogSwitch.EventName)) { EventManager.Instance.PostEvent(SurfaceSamplingData.DefaultJogSwitch.EventName, EventAction.SetSwitch, SurfaceSamplingData.DefaultJogSwitch.SwitchValue, base.gameObject); } } } else if (LocomotionUtils.IsInAir(animatorStateInfo) || LocomotionUtils.IsLanding(animatorStateInfo)) { if (locoStatus != LocomotionStatus.InAir || num != prevSurfaceTypeIndex) { locoStatus = LocomotionStatus.InAir; if (num >= 0) { if (!string.IsNullOrEmpty(SurfaceSamplingData.Effects[num].LandSwitch.SwitchValue)) { EventManager.Instance.PostEvent(SurfaceSamplingData.Effects[num].LandSwitch.EventName, EventAction.SetSwitch, SurfaceSamplingData.Effects[num].LandSwitch.SwitchValue, base.gameObject); } } else if (!string.IsNullOrEmpty(SurfaceSamplingData.DefaultLandSwitch.EventName)) { EventManager.Instance.PostEvent(SurfaceSamplingData.DefaultLandSwitch.EventName, EventAction.SetSwitch, SurfaceSamplingData.DefaultLandSwitch.SwitchValue, base.gameObject); } } } else if (tracker.IsCurrentControllerOfType <SlideController>()) { if (locoStatus != LocomotionStatus.Tubing || num != prevSurfaceTypeIndex) { locoStatus = LocomotionStatus.Tubing; if (num >= 0) { if (!string.IsNullOrEmpty(SurfaceSamplingData.Effects[num].TubeSlideLoopSwitch.SwitchValue)) { EventManager.Instance.PostEvent(SurfaceSamplingData.Effects[num].TubeSlideLoopSwitch.EventName, EventAction.SetSwitch, SurfaceSamplingData.Effects[num].TubeSlideLoopSwitch.SwitchValue, base.gameObject); } } else if (!string.IsNullOrEmpty(SurfaceSamplingData.DefaultTubeSlideLoopSwitch.EventName)) { EventManager.Instance.PostEvent(SurfaceSamplingData.DefaultTubeSlideLoopSwitch.EventName, EventAction.SetSwitch, SurfaceSamplingData.DefaultTubeSlideLoopSwitch.SwitchValue, base.gameObject); } } } else { locoStatus = LocomotionStatus.Unknown; } prevSurfaceTypeIndex = num; } yield return(new WaitForSeconds(sampleTime)); } }
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); } }