public override void OnActivate(GameObject activator) { //abort if locked or not enabled if (Locked || !enabled) { return; } //check eligibility of activator if (!CheckEligibility(activator)) { return; } //execute special var activatorController = activator.GetComponent <BaseController>(); var data = new ActionInvokerData() { Activator = activatorController }; Special.Invoke(data); //lock if not repeatable if (!Repeatable) { Locked = true; } }
void OnTriggerEnter(Collider other) { if (Triggered) { return; } //reject not-player if we're not allowing not-player if (OnPlayerOnly && !other.gameObject.IsPlayer()) { return; } //reject non-actors if we're not allowing not-actor if (OnActorsOnly && !other.gameObject.IsActor()) { return; } //execute special var activator = other.GetComponent <BaseController>(); var data = new ActionInvokerData() { Activator = activator }; Special.Invoke(data); //lock if not repeatable if (!Repeatable) { Triggered = true; SaveState(); } }
public void OnInteract(ActionInvokerData data) { if (InteractionDisabledByHit) { return; } if (UseDeadAction && ActorController.CurrentAiState == ActorAiState.Dead) { if (DeadInteraction != ActorInteractionType.None) { ExecuteInteraction(DeadInteraction, DeadInteractionTarget, DeadInteractionSpecial, data); } } else if (CorpseContainer != null && ActorController.CurrentAiState == ActorAiState.Dead && data.Activator is PlayerController) { ContainerModal.PushModal(GameState.Instance.PlayerRpgState.Inventory, CorpseContainer, false, null); } else { if (AltInteraction != ActorInteractionType.None && AlternateCondition.Parse().Evaluate()) { ExecuteInteraction(AltInteraction, AltInteractionTarget, AltInteractionSpecial, data); } else { ExecuteInteraction(Interaction, InteractionTarget, InteractionSpecial, data); } } }
public void InteractableExecute(ActionInvokerData data) { if (UseInteractPickup && data.Activator is PlayerController) { GrantInventory(); } }
public void InvokeContainer(ActionInvokerData data) //for invoking with an action special etc { if (data.Activator == null || !(data.Activator is PlayerController)) { return; } //Debug.Log("Opened container"); ContainerModal.PushModal(GameState.Instance.PlayerRpgState.Inventory, MyContainer, IsStore, null); }
public override void Execute(ActionInvokerData data) { if (Locked || (!AllowInvokeWhenDisabled && !isActiveAndEnabled)) { return; } ExecuteMicroscripts(); if (!Repeatable) { Locked = true; } }
public override void Execute(ActionInvokerData data) { if (Locked) { return; } SpawnObjectEx(); if (!Repeatable) { Locked = true; } }
public override void Execute(ActionInvokerData data) { if (Locked) { return; } ExecuteMicroscripts(); if (!Repeatable) { Locked = true; } }
public override void Execute(ActionInvokerData data) { if (Locked || (!AllowInvokeWhenDisabled && !isActiveAndEnabled)) { return; } DialogueInitiator.InitiateDialogue(Dialogue, Pause, null, TargetIsThis ? gameObject.name : null); if (!Repeatable) { Locked = true; } }
private bool CheckInteractionBlockedByFaction(ActionInvokerData data) { if (FactionRestriction == InteractionFactionMode.Unrestricted) { return(false); } if (IgnoreRestrictionIfDead && ActorController.CurrentAiState == ActorAiState.Dead) { return(false); } string otherFaction = PredefinedFaction.None.ToString(); if (data.Activator is PlayerController pc) { otherFaction = PredefinedFaction.Player.ToString(); } else if (data.Activator is ActorController ac) { otherFaction = ac.Faction; } string myFaction = ActorController.Faction; if (!(string.IsNullOrEmpty(myFaction) && string.IsNullOrEmpty(otherFaction))) { var relation = GameState.Instance.FactionState.GetRelation(myFaction, otherFaction); switch (FactionRestriction) { case InteractionFactionMode.NeutralOrFriendly: return(!(relation == FactionRelationStatus.Neutral || relation == FactionRelationStatus.Friendly)); case InteractionFactionMode.FriendlyOnly: return(!(relation == FactionRelationStatus.Friendly)); default: throw new NotImplementedException(); } } return(!AllowIfNoFaction); }
private void CheckTrigger() { if (Triggered) { return; } if (CheckCondition()) { ActionInvokerData d = new ActionInvokerData(); Special.Invoke(d); Triggered = true; if (Persistent) { SaveState(); } } }
private void CheckTrigger() { if (Triggered) { return; } if (GameState.Instance.CampaignState.HasFlag(Flag)) { ActionInvokerData d = new ActionInvokerData(); Special.Invoke(d); Triggered = true; if (Persistent) { SaveState(); } } }
public override void Execute(ActionInvokerData data) { if (Locked || (!AllowInvokeWhenDisabled && !isActiveAndEnabled)) { return; } if (data.Activator != null && WorldUtils.IsPlayer(data.Activator.gameObject)) { InventoryModel inventory = GameState.Instance.PlayerRpgState.Inventory; if (inventory.CountItem(InventoryItem) > 0) { Special.Invoke(data); if (Consume) { inventory.RemoveItem(InventoryItem, 1); } } if (!Repeatable) { Locked = true; } } else if (PassthroughNonPlayerAction) { Special.Invoke(data); if (!Repeatable) //should we do this? { Locked = true; } } if (!Repeatable && LockEvenOnFail) { Locked = true; } }
public override void Execute(ActionInvokerData data) { if (!enabled && !AllowInvokeWhenDisabled) { return; } if (Triggered && !Repeatable) { return; } string target = null; switch (Target) { case TargetType.Activator: target = data.Activator.Ref()?.gameObject.name; break; case TargetType.NearestController: target = GetComponentInParent <BaseController>().Ref()?.gameObject.name; break; case TargetType.ByTID: target = TargetId; break; case TargetType.ByReference: target = TargetReference.name; break; } DialogueInitiator.SetDynamicDialogue(ImmersiveMonologue.BuildDialogueScene()); DialogueInitiator.InitiateDialogue(DialogueModule.DynamicDialogueName, Pause, null, target); Triggered = true; }
private void ExecuteInteraction(ActorInteractionType type, string target, ActionSpecial special, ActionInvokerData data) { switch (type) { case ActorInteractionType.None: break; //do nothing case ActorInteractionType.Special: special.Execute(data); break; case ActorInteractionType.AmbientMonologue: string msg = DialogueModule.GetMonologue(target).GetLineRandom(); //VERY inefficient, will fix later //QdmsMessageBus.Instance.PushBroadcast(new HUDPushMessage(msg));//also a very temporary display QdmsMessageBus.Instance.PushBroadcast(new SubtitleMessage(msg, 5.0f, true, -1)); //and we need to rework Monologue and implement an audio manager before we can do speech break; case ActorInteractionType.Dialogue: DialogueInitiator.InitiateDialogue(target, true, null); break; case ActorInteractionType.Script: ScriptingModule.Call(target, new ScriptExecutionContext() { Caller = this, Activator = data.Activator.gameObject }, new object[] { }); break; default: throw new NotImplementedException(); } }