public static IEnumerator nudgePlayer(LocomotionTracker locomotionTracker, System.Action nudgeCompleted = null) { float finishTime = Time.time + UnityEngine.Random.Range(0.2f, 0.4f); _ = Vector2.down; Vector2 direction; switch (UnityEngine.Random.Range(1, 5)) { case 1: direction = Vector2.up; break; case 2: direction = Vector2.left; break; case 3: direction = Vector2.right; break; default: direction = Vector2.down; break; } while (Time.time < finishTime && !locomotionTracker.gameObject.IsDestroyed()) { locomotionTracker.GetCurrentController().Steer(direction); yield return(null); } nudgeCompleted?.Invoke(); }
private void OnEnable() { prevLocoController = tracker.GetCurrentController(); ResetState(); if (CompareTag("Player")) { LoadContextualControlsLayout(); } }
public static LocomotionController GetCurrentController(GameObject target) { LocomotionTracker component = target.GetComponent <LocomotionTracker>(); if (component != null) { return(component.GetCurrentController()); } return(null); }
public void OnApplicationPause(bool pauseStatus) { LocomotionController currentController = tracker.GetCurrentController(); if (currentController != null) { currentController.Steer(Vector3.zero); } }
private void OnEnable() { if (canSitFromCurrentState() || !base.gameObject.CompareTag("Player")) { prevLocoController = tracker.GetCurrentController(); animator.SetBool(AnimationHashes.Params.Sit, value: true); mode = Mode.Jumping; exitingViaJump = false; base.Broadcaster.OnInteractionPreStartedEvent += onInteractionPreStartedEvent; base.Broadcaster.BroadcastOnControlsLocked(); } else { base.enabled = false; } if (base.gameObject.CompareTag("Player")) { LoadControlsLayout(); } }
protected void startInteraction() { GameObject gameObject = ActionSequencer.FindActionGraphObject(currentActionGraphGameObject); if (gameObject != null && SceneRefs.ActionSequencer.StartSequence(base.gameObject, gameObject)) { if (locoEventBroadcaster != null) { locoEventBroadcaster.BroadcastOnInteractionStarted(gameObject); } if (AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var handle) && dataEntityCollection.TryGetComponent <SessionIdData>(handle, out var component)) { dispatcher.DispatchEvent(new PenguinInteraction.InteractionStartedEvent(component.SessionId, gameObject)); } LocomotionController currentController = locomotionTracker.GetCurrentController(); if (currentController != null && (gameObject.GetComponent <ToggleCoreGameplayAction>() != null || gameObject.GetComponent <WarpTunnelAction>() != null)) { currentController.OnBlockingInteractionStarted(); } interactRequest.Reset(); RetainParticipationWithActionGraphGO(); SceneRefs.ActionSequencer.SequenceCompleted += OnActionSequencerSequenceCompleted; } }
private void OnTriggerStay(Collider trigger) { SurfaceSwimProperties surfaceSwimProperties = getVolumeTriggerProperties(trigger); if (!base.enabled && Active && (tracker.IsCurrentControllerOfType <RunController>() || (tracker.IsCurrentControllerOfType <SlideController>() && (tracker.GetCurrentController() as SlideController).CurrentMode == SlideController.Mode.Animated)) && surfaceSwimProperties != null && (surfaceSwimProperties.Type == SurfaceSwimProperties.VolumeType.Diving || !isWaterTooShallow(mutableData.MaxShallowWaterDepth + mutableData.ShallowWaterDepthHysteresis))) { tracker.SetCurrentController <SwimController>(); enableWaterEffects(); } }