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(); }
private void GenerateActions() { ActionSequencer sequencer = target as ActionSequencer; AnimatorController controller = sequencer.controller as AnimatorController; while (sequencer.transform.childCount > 0) { DestroyImmediate(sequencer.transform.GetChild(0).gameObject); } AnimatorControllerLayer mainLayer = controller.layers[0]; AnimatorState state = mainLayer.stateMachine.defaultState; GameObject stateParentGameObject = new GameObject(state.name); stateParentGameObject.transform.parent = sequencer.transform; while (state.transitions.Length > 0) { AnimatorState subState = state.transitions[0].destinationState; GameObject subStateGameObject = new GameObject(subState.name); subStateGameObject.transform.parent = stateParentGameObject.transform; state = subState; stateParentGameObject = subStateGameObject; } /* * foreach(ChildAnimatorState childState in mainLayer.stateMachine.states) * { * GameObject go = new GameObject(childState.state.name); * go.transform.parent = sequencer.transform; * }*/ }
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); } } }
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(); } } }
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(); } } }
private void Awake() { rigidBody = GetComponent <Rigidbody>(); boxCollider = GetComponents <BoxCollider>(); rigidBody.isKinematic = true; rigidBody.useGravity = false; for (int i = 0; i < boxCollider.Length; i++) { boxCollider[i].isTrigger = true; } foreach (ActionSequencer sequencer in GetComponentsInChildren <ActionSequencer>()) { if (sequencer.name == "OnEnter") { enterActions = sequencer; } else if (sequencer.name == "OnExit") { exitActions = sequencer; } } if (null == enterActions) { GameObject enterActionGo = new GameObject("OnEnter"); enterActionGo.transform.SetParent(transform); enterActions = enterActionGo.AddComponent <ActionSequencer>(); } if (null == exitActions) { GameObject exitActionGo = new GameObject("OnExit"); exitActionGo.transform.SetParent(transform); exitActions = exitActionGo.AddComponent <ActionSequencer>(); } if (gameObject.name.Equals("GameObject")) { gameObject.name = "AreaTrigger"; } }
void AttackProcess(Character me, Character other) { bool AttackHitFlag = true; ActionSequencer otherCharacterActSeq = other.ActionSequencer; if (otherCharacterActSeq != null) { if (otherCharacterActSeq.Active) { if (otherCharacterActSeq.CurrentMode == ActionSequencer.Mode.MAIN) { ActionParamater otherActParam = otherCharacterActSeq.CurrentActionParamater; if (otherActParam != null) { switch (otherActParam.Type) { case ActionParamater.TYPE.DODGE: AttackHitFlag = false; break; case ActionParamater.TYPE.GUARD: AttackHitFlag = false; break; default: break; } } } } } if (AttackHitFlag) { other.OnAttacked(me); } }
private void Awake() { rigidBody = GetComponent <Rigidbody>(); boxCollider = GetComponent <BoxCollider>(); rigidBody.isKinematic = true; rigidBody.useGravity = false; boxCollider.isTrigger = true; foreach (ActionSequencer sequencer in GetComponentsInChildren <ActionSequencer>()) { if (sequencer.name == "OnEnter") { enterActions = sequencer; } else if (sequencer.name == "OnExit") { exitActions = sequencer; } } if (null == enterActions) { GameObject enterActionGo = new GameObject("OnEnter"); enterActionGo.transform.SetParent(transform); enterActions = enterActionGo.AddComponent <ActionSequencer>(); } if (null == exitActions) { GameObject exitActionGo = new GameObject("OnExit"); exitActionGo.transform.SetParent(transform); exitActions = exitActionGo.AddComponent <ActionSequencer>(); } if (String.IsNullOrWhiteSpace(gameObject.name)) { gameObject.name = "AreaTrigger"; } }
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); } } }
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(); } }
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; } }
public void EndAction() { ActionSequencer.EndActionContinulation(); }
public static void SetActionSequencer(ActionSequencer actionSequencer) { ActionSequencer = actionSequencer; }