public void EventSelection(ScriptableAction eve, bool decision = false) { acceptedEvents.Add(eve); if (!decision) { _technologyParent = acceptedEvents[acceptedEvents.Count - 1].uiTransform; if (acceptedEvents.Count > 1) { foreach (ScriptableAction ev in acceptedEvents[acceptedEvents.Count - 2].connectedEvents) { if (acceptedEvents[acceptedEvents.Count - 1] != ev) { unManagedEvents.Add(ev); } } } for (int i = 0; i < acceptedEvents[acceptedEvents.Count - 1].connectedEvents.Length; ++i) { ActionButtonBehaviour button = Instantiate(_eventPrefab, _technologyParent).GetComponent <ActionButtonBehaviour>(); button.action = acceptedEvents[acceptedEvents.Count - 1].connectedEvents[i]; button.index = i; button.world = this; } } AddEventToIndustry(acceptedEvents[acceptedEvents.Count - 1]); }
public void RemoveEventFromIndustry(ScriptableAction ev) { foreach (IndustryTypes industry in ev.affectedIndustries) { foreach (CountryBehaviour country in _countries) { country._nodes[(int)industry].pendingEvents.Remove(ev); } } acceptedEvents.Remove(ev); }
public AirlockConstruct(ISelector <IMyDoor> innerDoor, ISelector <IMyDoor> outerDoor, ISelector <IMyAirVent> vent) { _innerDoor = innerDoor.GetBlock(); _outerDoor = outerDoor.GetBlock(); _vent = vent.GetBlock(); _status = _vent.Status; _enabled = _vent.Enabled; CycleAction = new ScriptableAction(() => Cycle()); PressurizeAction = new ScriptableAction(() => Cycle(true)); DepressurizeAction = new ScriptableAction(() => Cycle(false)); _triggers.Add(new IntervalTrigger(300).Then(new ScriptableAction(Update))); }
public override bool Equals(object other) { if (other == null) { return(false); } ScriptableAction nObj = other as ScriptableAction; if (nObj == null) { return(false); } return(this.actionName == nObj.actionName); }
private ScriptableAction getNextAction() { ScriptableAction result = null; if (interaction != null && currentStepIndex < Track.Steps.Length) { InteractionDefinition.Track.Step step = Track.Steps[currentStepIndex]; if (step.SyncPointIndex >= 0) { interaction.reachedSyncPoint(step.SyncPointIndex, TrackIndex); result = ((!interaction.isSyncPointReady(step.SyncPointIndex)) ? ScriptableActionPause.Instance : step.Action); } else { result = step.Action; } } return(result); }
void AddEventToIndustry(ScriptableAction ev) { foreach (IndustryTypes industry in ev.affectedIndustries) { foreach (CountryBehaviour country in _countries) { ScriptableAction nev = ScriptableObject.CreateInstance <ScriptableAction>(); nev.actionName = ev.actionName; nev.description = ev.description; nev.influence = new Gases(); nev.influence += ev.influence; nev.image = ev.image; nev.affectedIndustries = ev.affectedIndustries; nev.connectedEvents = ev.connectedEvents; nev.uiTransform = ev.uiTransform; nev.ammountAccepted = ev.ammountAccepted; country._nodes[(int)industry].pendingEvents.Add(nev); } } }
private void onClick(ScriptableActionPlayer player, ScriptableAction nextStep) { player.NextAction = nextStep; player.ActionIsFinished = true; }