private void onControllerChangedEvent(LocomotionController newController) { if (!(newController is SitController) && !consuming) { Change(onoff: false); } }
public void BroadcastOnControllerChanged(LocomotionController newController) { if (this.OnControllerChangedEvent != null) { this.OnControllerChangedEvent(newController); } }
public void DisableAllControllers() { LocomotionController[] components = GetComponents <LocomotionController>(); for (int i = 0; i < components.Length; i++) { components[i].enabled = false; } curController = null; }
private void OnEnable() { prevLocoController = tracker.GetCurrentController(); ResetState(); if (CompareTag("Player")) { LoadContextualControlsLayout(); } }
public void OnApplicationPause(bool pauseStatus) { LocomotionController currentController = tracker.GetCurrentController(); if (currentController != null) { currentController.Steer(Vector3.zero); } }
private bool onRotate(InputEvents.RotateEvent evt) { LocomotionController currentController = tracker.GetCurrentController(); if (currentController != null) { currentController.SteerRotation(evt.Direction); } return(false); }
protected override void OnEnable() { AnimatorStateInfo animatorStateInfo = LocomotionUtils.GetAnimatorStateInfo(animator); LocomotionController currentController = GetComponent <LocomotionTracker>().GetCurrentController(); if (currentController is SlideController) { base.Sled = ((SlideController)currentController).Sled; base.SledTransform = ((SlideController)currentController).SledTransform; base.Pilot = ((SlideController)currentController).Pilot; if (base.Sled == null || base.SledTransform == null || base.Pilot == null || LocomotionUtils.IsInAir(animatorStateInfo) || LocomotionUtils.IsLanding(animatorStateInfo) || ((SlideController)currentController).CurrentMode == Mode.Animated) { base.enabled = false; return; } ((SlideController)currentController).ToRaceController = true; FromSlideController = true; } else if (!LocomotionUtils.IsIdling(animatorStateInfo) && !LocomotionUtils.IsLocomoting(animatorStateInfo)) { base.enabled = false; return; } base.OnEnable(); if (myMutableData.SpeedLinesTubeRacePrefab != null) { speedLines = Object.Instantiate(myMutableData.SpeedLinesTubeRacePrefab); CameraCullingMaskHelper.SetLayerIncludingChildren(speedLines.transform, LayerMask.LayerToName(base.gameObject.layer)); Vector3 localPosition = new Vector3(speedLines.transform.position.x, speedLines.transform.position.y, speedLines.transform.position.z); Quaternion localRotation = new Quaternion(speedLines.transform.rotation.x, speedLines.transform.rotation.y, speedLines.transform.rotation.z, speedLines.transform.rotation.w); speedLines.transform.parent = base.transform; speedLines.transform.localPosition = localPosition; speedLines.transform.localRotation = localRotation; speedLines.SetActive(value: false); } if (visualizeTrackSegment) { steeringObject = new GameObject(); steeringObjectRenderer = steeringObject.AddComponent <LineRenderer>(); steeringObjectRenderer.transform.parent = base.gameObject.transform; steeringObjectRenderer.useWorldSpace = true; trackDirObject = new GameObject(); trackDirRenderer = trackDirObject.AddComponent <LineRenderer>(); trackDirObject.transform.parent = base.gameObject.transform; trackDirRenderer.useWorldSpace = true; } if (FromSlideController) { mode = Mode.Animated; base.IsSliding = true; } steerVel = Vector3.zero; }
public void DisallowController <T>(float delay) where T : LocomotionController { LocomotionController component = GetComponent <T>(); if (disallowedControllers.ContainsKey(component)) { disallowedControllers[component] = Time.time + delay; } else { disallowedControllers.Add(component, Time.time + delay); } }
private bool OnMove(InputEvents.MoveEvent evt) { if (SceneRefs.ActionSequencer != null) { SceneRefs.ActionSequencer.UserInputReceived(); } LocomotionController currentController = tracker.GetCurrentController(); if (currentController != null) { currentController.Steer(evt.Direction); } return(false); }
private bool OnActionEnabled(InputEvents.ActionEnabledEvent evt) { LocomotionController currentController = tracker.GetCurrentController(); if (currentController != null) { InputEvents.Actions action = evt.Action; if (action == InputEvents.Actions.Snowball) { currentController.EnableAction(LocomotionController.LocomotionAction.ChargeThrow, evt.Enabled); } } return(false); }
private bool OnLocomotionStateChange(InputEvents.LocomotionStateEvent evt) { if (SceneRefs.ActionSequencer != null) { SceneRefs.ActionSequencer.UserInputReceived(); } LocomotionController currentController = tracker.GetCurrentController(); if (currentController != null) { currentController.SetState(evt.LocomotionState); } return(false); }
private bool isControllerAllowed(LocomotionController controller) { bool result = true; if (disallowedControllers.ContainsKey(controller)) { if (disallowedControllers[controller] < Time.time) { disallowedControllers.Remove(controller); } else { result = false; } } return(result); }
private bool OnChargeAction(InputEvents.ChargeActionEvent evt) { LocomotionController currentController = tracker.GetCurrentController(); if (currentController != null && evt.Action == InputEvents.ChargeActions.Snowball) { if (evt.ButtonState) { currentController.DoAction(LocomotionController.LocomotionAction.ChargeThrow); } else { currentController.DoAction(LocomotionController.LocomotionAction.LaunchThrow, evt.HoldTime); } } return(false); }
public bool SetCurrentController(LocomotionController controller) { if (curController == controller) { return(true); } if (!controller.enabled && isControllerAllowed(controller)) { controller.enabled = true; if (controller.enabled && curController != null) { curController.enabled = false; curController = controller; controller.Broadcaster.BroadcastOnControllerChanged(controller); } } return(curController == controller); }
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(); } }
private LocomotionController findCurrentController() { LocomotionController locomotionController = null; LocomotionController[] components = GetComponents <LocomotionController>(); for (int i = 0; i < components.Length; i++) { if (components[i].enabled) { if (locomotionController == null) { locomotionController = components[i]; } else { components[i].enabled = false; } } } return(locomotionController); }
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 bool OnAction(InputEvents.ActionEvent evt) { LocomotionController currentController = tracker.GetCurrentController(); if (currentController != null) { switch (evt.Action) { case InputEvents.Actions.Jump: if (SceneRefs.ActionSequencer != null) { SceneRefs.ActionSequencer.UserInputReceived(); } currentController.DoAction(LocomotionController.LocomotionAction.Jump); break; case InputEvents.Actions.Torpedo: if (SceneRefs.ActionSequencer != null) { SceneRefs.ActionSequencer.UserInputReceived(); } currentController.DoAction(LocomotionController.LocomotionAction.Torpedo); break; case InputEvents.Actions.Interact: if (!Service.Get <PropService>().IsLocalUserUsingProp() || Service.Get <PropService>().CanActionsBeUsedWithProp()) { if (SceneRefs.ActionSequencer != null) { SceneRefs.ActionSequencer.UserInputReceived(); } currentController.DoAction(LocomotionController.LocomotionAction.Interact); } break; case InputEvents.Actions.Action1: if (SceneRefs.ActionSequencer != null) { SceneRefs.ActionSequencer.UserInputReceived(); } currentController.DoAction(LocomotionController.LocomotionAction.Action1); break; case InputEvents.Actions.Action2: if (SceneRefs.ActionSequencer != null) { SceneRefs.ActionSequencer.UserInputReceived(); } currentController.DoAction(LocomotionController.LocomotionAction.Action2); break; case InputEvents.Actions.Action3: if (SceneRefs.ActionSequencer != null) { SceneRefs.ActionSequencer.UserInputReceived(); } currentController.DoAction(LocomotionController.LocomotionAction.Action3); break; } } return(false); }
private void Start() { curController = findCurrentController(); }
public void TEMPHACK_ResetCurController() { curController = null; }