private void Update()
        {
            if (participationData == null || participationData.ParticipatingGO == null)
            {
                return;
            }
            GameObject gameObject = ActionSequencer.FindActionGraphObject(participationData.ParticipatingGO.Value);

            if (gameObject != null)
            {
                if (participationData.CurrentParticipationState == ParticipationState.Participating)
                {
                    if (interactRequest.Active && gameObject.activeInHierarchy)
                    {
                        Service.Get <ActionConfirmationService>().ConfirmAction(typeof(PenguinInteraction), gameObject, delegate
                        {
                            CoroutineRunner.Start(preStartInteraction(participantReference.Value), this, "preStartInteraction");
                        });
                        interactRequest.Reset();
                    }
                }
                else if (participationData.CurrentParticipationState == ParticipationState.Pending && !canInteractWithActionGraph(gameObject))
                {
                    participationController.ClearPriorityCompetition(participantReference);
                }
            }
            interactRequest.Update();
        }
Example #2
0
        private void RunActionGraph(GameObject targetGameObject)
        {
            GameObject gameObject = ActionSequencer.FindActionGraphObject(targetGameObject);

            if (gameObject != null && canInteractWithActionGraph(gameObject))
            {
                currentActionGraphGameObject = gameObject;
                interactRequest.Set();
            }
        }
 protected override void RetainParticipationWithActionGraphGO()
 {
     if (participantReference != null)
     {
         GameObject gameObject = ActionSequencer.FindActionGraphObject(participantReference.Value);
         if (gameObject != null && !participationController.LockParticipation(new ParticipationRequest(ParticipationRequest.Type.Lock, participantReference, "PenguinInteraction")))
         {
             OnActionSequencerSequenceCompleted(base.gameObject);
         }
     }
 }
Example #4
0
        protected IEnumerator preStartInteraction(GameObject go)
        {
            if (!base.gameObject.IsDestroyed() && AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var _) && locoEventBroadcaster != null && !go.IsDestroyed())
            {
                GameObject actionGraphObject = ActionSequencer.FindActionGraphObject(go);
                if (!actionGraphObject.IsDestroyed())
                {
                    locoEventBroadcaster.BroadcastOnInteractionPreStarted(actionGraphObject);
                    yield return(CoroutineRunner.Start(waitForValidLocomotionModeToInteract(), this, "waitForValidLocomotionModeToInteract"));

                    startInteraction();
                }
            }
        }
Example #5
0
        public void OnTriggerEnter(Collider collider)
        {
            if (interactRequest.Active)
            {
                return;
            }
            GameObject gameObject = ActionSequencer.FindActionGraphObject(collider.gameObject);

            if (gameObject != null && AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var _) && canInteractWithActionGraph(gameObject))
            {
                ForceInteractionAction component = gameObject.GetComponent <ForceInteractionAction>();
                if (component != null)
                {
                    currentActionGraphGameObject = gameObject;
                    interactRequest.Set();
                }
            }
        }
        public void OnTriggerEnter(Collider collider)
        {
            GameObject gameObject = ActionSequencer.FindActionGraphObject(collider.gameObject);

            if (!AvatarDataHandle.TryGetPlayerHandle(base.gameObject, out var _) || !(gameObject != null) || !canInteractWithActionGraph(gameObject))
            {
                return;
            }
            ForceInteractionAction component = gameObject.GetComponent <ForceInteractionAction>();

            if (component != null)
            {
                ParticipationRequest.Type type    = ParticipationRequest.Type.ForcedInteraction;
                ParticipationRequest      request = new ParticipationRequest(type, gameObject, "PenguinInteraction");
                participationController.PrepareParticipation(request);
                if (participationData != null && participationData.ParticipatingGO != null && participationData.ParticipatingGO.Value == gameObject)
                {
                    participantReference         = participationData.ParticipatingGO;
                    currentActionGraphGameObject = gameObject;
                    interactRequest.Set();
                }
            }
            else
            {
                ParticipationRequest.Type type     = ParticipationRequest.Type.Prepare;
                ParticipationRequest      request2 = new ParticipationRequest(type, gameObject, "PenguinInteraction");
                if (!isReadyForParticipation)
                {
                    pendingParticipationRequest = request2;
                }
                else
                {
                    participationController.PrepareParticipation(request2);
                }
            }
        }
Example #7
0
        public void OnPositionTimelineTriggerActionEvent(LocomotionActionEvent evt)
        {
            if (evt.Type != LocomotionAction.Interact || evt.Object == null || interactRequest.Active)
            {
                return;
            }
            switch (evt.Object.type)
            {
            case ObjectType.LOCAL:
            {
                GameObject gameObject = GameObject.Find(evt.Object.id);
                if (gameObject != null)
                {
                    RunActionGraph(gameObject);
                }
                break;
            }

            case ObjectType.SERVER:
            {
                long key = long.Parse(evt.Object.id);
                if (Service.Get <PropService>().propExperienceDictionary.ContainsKey(key))
                {
                    currentActionGraphGameObject = ActionSequencer.FindActionGraphObject(Service.Get <PropService>().propExperienceDictionary[key]);
                    interactRequest.Set();
                }
                break;
            }

            case ObjectType.PLAYER:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Example #8
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;
            }
        }