Exemplo n.º 1
0
 private void onControllerChangedEvent(LocomotionController newController)
 {
     if (!(newController is SitController) && !consuming)
     {
         Change(onoff: false);
     }
 }
Exemplo n.º 2
0
 public void BroadcastOnControllerChanged(LocomotionController newController)
 {
     if (this.OnControllerChangedEvent != null)
     {
         this.OnControllerChangedEvent(newController);
     }
 }
Exemplo n.º 3
0
 public void DisableAllControllers()
 {
     LocomotionController[] components = GetComponents <LocomotionController>();
     for (int i = 0; i < components.Length; i++)
     {
         components[i].enabled = false;
     }
     curController = null;
 }
Exemplo n.º 4
0
 private void OnEnable()
 {
     prevLocoController = tracker.GetCurrentController();
     ResetState();
     if (CompareTag("Player"))
     {
         LoadContextualControlsLayout();
     }
 }
Exemplo n.º 5
0
        public void OnApplicationPause(bool pauseStatus)
        {
            LocomotionController currentController = tracker.GetCurrentController();

            if (currentController != null)
            {
                currentController.Steer(Vector3.zero);
            }
        }
Exemplo n.º 6
0
        private bool onRotate(InputEvents.RotateEvent evt)
        {
            LocomotionController currentController = tracker.GetCurrentController();

            if (currentController != null)
            {
                currentController.SteerRotation(evt.Direction);
            }
            return(false);
        }
Exemplo n.º 7
0
        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;
        }
Exemplo n.º 8
0
        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);
            }
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
        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);
        }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
 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);
 }
Exemplo n.º 15
0
 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();
     }
 }
Exemplo n.º 16
0
        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);
        }
Exemplo n.º 17
0
        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;
            }
        }
Exemplo n.º 18
0
        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);
        }
Exemplo n.º 19
0
 private void Start()
 {
     curController = findCurrentController();
 }
Exemplo n.º 20
0
 public void TEMPHACK_ResetCurController()
 {
     curController = null;
 }