/// <summary> /// Checks the analysis results for all connections. /// Will only perform the check for the connection that have sufficient rights; will not show the action progress. /// </summary> public static void CheckForAnalysisResults() { List <AsyncAction> actions = new List <AsyncAction>(); foreach (IXenConnection xenConnection in ConnectionsManager.XenConnectionsCopy) { var action = GetAction(xenConnection, true); if (action != null) { actions.Add(action); } } if (actions.Count == 1) { actions[0].Completed += actionCompleted; actions[0].RunAsync(); } else if (actions.Count > 1) { var parallelAction = new ParallelAction(null, "", "", "", actions, true, true); parallelAction.Completed += actionCompleted; parallelAction.RunAsync(); } }
public void MultiTarget() { ParallelAction parallel = new ParallelAction(); parallel.name = "SkillCast"; string vfx = "Thunder"; AnimeAction action1 = CreateCastAction("target1", vfx, enemyAnimator, 1000); parallel.AddAction(action1); AnimeAction action2 = CreateCastAction("target2", vfx, enemyAnimator2, 777); parallel.AddAction(action2); AnimatorAction animeAction = new AnimatorAction(); animeAction.name = "character"; animeAction.animator = charAnimator; animeAction.triggerState = "Cast"; animeAction.onHitAction = parallel; actionManager.RunAction(animeAction); }
public void Flow(ActionTree actionTree) { CoverModel.Instance.Flow(); List <CoverAnimInfo> anims = CoverModel.Instance.anims[0]; for (int i = 0; i < anims.Count; i++) { CoverAnimInfo animInfo = anims[i]; FightCoverItem item = GetItemByRunId(animInfo.coverInfo.runId); if (item != null) { ParallelAction paralle = new ParallelAction(); Vector2 toPos = PosMgr.GetFightCellPos(animInfo.coverInfo.posX, animInfo.coverInfo.posY); paralle.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.3f)); OrderAction orderAction = new OrderAction(); orderAction.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0.5f, 0.5f, 1), 0.1f)); orderAction.AddNode(new WaitActor(100)); orderAction.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.1f)); paralle.AddNode(orderAction); actionTree.AddNode(paralle); } } }
private void PlayPropClear() { List <List <CellAnimInfo> > cellAnims = CellModel.Instance.anims; rootAction = new OrderAction(); for (int i = 0; i < cellAnims.Count; i++) { ParallelAction paralle = new ParallelAction(); List <CellAnimInfo> cellAnimss = cellAnims[i]; int j; for (j = 0; j < cellAnimss.Count; j++) { CellAnimInfo animInfo = cellAnimss[j]; FightCellItem item = GetItemByRunId(animInfo.runId); OrderAction order = new OrderAction(); switch (animInfo.animationType) { case CellAnimType.clear: order.AddNode(new PlaySoundActor("bomb")); order.AddNode(new ShowEffectActor(item.transform, "effect_cell_clear", fightModule.transform)); order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.1f)); order.AddNode(new DestroyActor(item.gameObject)); break; } paralle.AddNode(order); } rootAction.AddNode(paralle); } ExecuteAction(FightStadus.prop_eliminate); }
private void UnlockHide() { List <int> unLockIds = HideModel.Instance.UnLock(); HideModel.Instance.BackUpUnLock(unLockIds); rootAction = new OrderAction(); ParallelAction paralle = new ParallelAction(); for (int j = 0; j < unLockIds.Count; j++) { int unLockId = unLockIds[j]; FightHideItem item = floorHideLayer.GetItemByRunId(unLockId); OrderAction unlockOrder = new OrderAction(); if (item.hiderInfo.isNull) { unlockOrder.AddNode(new SetLayerActor(item.transform, effectLayer.transform)); unlockOrder.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1.25f, 1.25f, 0), 0.15f)); unlockOrder.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.25f)); unlockOrder.AddNode(new DestroyActor(item)); } paralle.AddNode(unlockOrder); } rootAction.AddNode(paralle); ExecuteAction(FightStadus.unlock_hide); }
public static async Task <JToken> ExecuteAsync(this ParallelAction action, StateMachineContext context, JToken input) { action.CheckArgNull(nameof(action)); context.CheckArgNull(nameof(context)); input.CheckArgNull(nameof(input)); var output = new JObject(); var tasks = action.Actions.Select(async(a, idx) => { var item = await a.ExecuteAsync(context, input.DeepClone()); Debug.Assert(item != null); var id = string.IsNullOrWhiteSpace(a.Name) ? idx.ToString() : a.Name; return(id, item); }).ToList(); if (action.CompletionType == ParallelCompletionType.And) { var results = await Task.WhenAll(tasks); Array.ForEach(results, tuple => output[tuple.id] = tuple.item); } else if (action.CompletionType == ParallelCompletionType.Xor) { var resultTask = await Task.WhenAny(tasks); var tuple = await resultTask; output[tuple.id] = tuple.item; } else { Debug.Assert(action.CompletionType == ParallelCompletionType.N_of_M); Debug.Assert(action.N > 0); var resultCount = 0; while (resultCount < action.N && resultCount < tasks.Count) { var resultTask = await Task.WhenAny(tasks); tasks.Remove(resultTask); var tuple = await resultTask; output[tuple.id] = tuple.item; resultCount++; } } return(output); }
void Start() { // Set scale transform.localScale = scale; gameObject.Play(ParallelAction.ParallelAll(ScaleAction.ScaleTo(scale * Random.Range(minScale, maxScale), scaleDuration), FadeAction.FadeOut(fadeDuration)), () => { GameObject.Destroy(gameObject); }); }
void Sink() { var delay = DelayAction.Create(0.5f); var disableSwing = CallFuncAction.Create(() => { _swingEnabled = false; }); var move = MoveAction.MoveBy(new Vector3(0, -sinkDelta, 0), 0.5f, Ease.SineIn); var fadeOut = FadeAction.RecursiveFadeOut(0.5f); gameObject.Play(SequenceAction.Create(delay, disableSwing, ParallelAction.ParallelAll(move, fadeOut)), () => { SelfDestroy(); }); }
private void Filling(FightStadus fightState = FightStadus.move, int waitmillisecond = 0) { CellModel.Instance.anims = new List <List <CellAnimInfo> >(); FunMove.Move(false, isDeductStep); List <CellMoveInfo> moveAnims = CellModel.Instance.moveAnims; rootAction = new OrderAction(); ParallelAction paralle = new ParallelAction(); Dictionary <int, int> newStartPos = new Dictionary <int, int>(); for (int i = 0; i < moveAnims.Count; i++) { CellMoveInfo cellMoveInfo = moveAnims[i]; OrderAction orderAction = new OrderAction(); paralle.AddNode(orderAction); FightCellItem item = GetItemByRunId(cellMoveInfo.cellInfo.runId); if (item == null) { item = CreateCellItem(cellMoveInfo.cellInfo).GetComponent <FightCellItem>(); int xKey = (int)cellMoveInfo.paths[0].x; if (newStartPos.ContainsKey(xKey)) { int preIndex = newStartPos[xKey]; newStartPos[xKey] = preIndex - 1; } else { newStartPos.Add(xKey, -1); } PosUtil.SetFightCellPos(item.transform, xKey, newStartPos[xKey]); } for (int j = 0; j < cellMoveInfo.paths.Count; j++) { Vector2 pathPoint = cellMoveInfo.paths[j]; Vector2 toPos = PosUtil.GetFightCellPos((int)pathPoint.x, (int)pathPoint.y); float speed = isDeductStep ? 1750 : 1350; orderAction.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), speed)); } FightEffectItem effectItem = effectLayer.GetEffectItemByPos(cellMoveInfo.cellInfo.posX, cellMoveInfo.cellInfo.posY); orderAction.AddNode(new PlayCellMoveEndActor(item, effectItem, cellMoveInfo.cellInfo)); } if (waitmillisecond > 0) { rootAction.AddNode(new WaitActor(waitmillisecond)); } rootAction.AddNode(paralle); ExecuteAction(fightState); }
/** * Creates the gameState for the PatientScene */ protected override IList <GameState> GetGameStatesList() { //Gets the Dialog object from the camera for the dialog action DialogManager dialog = Camera.main.GetComponent <DialogManager>(); SoundManager soundManager = GameObject.Find("SoundManager").GetComponent <SoundManager> (); GameObject obj = GameObject.Find("Main Camera"); if (obj == null) { Debug.Log("couldn't find Main Camera"); } soundManager.addSound(new Sound(obj, "Assets/backgroundMusic.mp3", "background")); //Inital parallel actions: the black screen and looping cell phone ringing IList <ActionRunner> startActionList = new List <ActionRunner> (); startActionList.Add(new FadeAction(true)); //Fade to black startActionList.Add(new SoundAction("background", true)); ParallelAction startActions = new ParallelAction(startActionList); //Creates the Parallel Action list for the Shake State transition IList <ActionRunner> yesStateActionList = new List <ActionRunner> (); yesStateActionList.Add(new DialogAction("Waking up", 3F)); ParallelAction shakeActions = new ParallelAction(yesStateActionList); if (dialog == null) { Debug.Log("null pointer with dialog"); } return(new List <GameState> { new GameState( "start", new Dictionary <Trigger, string>() { { new NodTrigger(GameObject.Find("patient")), "shake" }, { new ShakeTrigger(GameObject.Find("patient")), "shake" } }, startActions ), new GameState( "shake", new Dictionary <Trigger, string>() { }, shakeActions, new FadeAction(true) //stop Fading to black ) }); }
internal void ResetTask(int iterations, int chunkSize, ParallelAction action) { Wait(); m_TasksCompleted = 0; m_Action = action; var taskCount = 0; for (var i = 0; i < iterations; i += chunkSize) { taskCount++; } m_TaskCount = taskCount; m_IsFinished.Reset(); }
void Unsink() { gameObject.SetAlpha(0, true); Vector3 position = transform.position; position.y -= sinkDelta; var delay = DelayAction.Create(0.05f); var setPosition = SetPositionAction.Create(position); var move = MoveAction.MoveBy(new Vector3(0, sinkDelta, 0), 0.5f, Ease.SineOut); var fadeIn = FadeAction.RecursiveFadeIn(0.5f); gameObject.Play(SequenceAction.Create(delay, setPosition, ParallelAction.ParallelAll(move, fadeIn)), () => { _swingEnabled = true; }); }
public static void RestoreDismissedUpdates() { var actions = new List <AsyncAction>(); foreach (IXenConnection connection in ConnectionsManager.XenConnectionsCopy) { actions.Add(new RestoreDismissedUpdatesAction(connection)); } var action = new ParallelAction(Messages.RESTORE_DISMISSED_UPDATES, Messages.RESTORING, Messages.COMPLETED, actions, true, false); action.Completed += action_Completed; RestoreDismissedUpdatesStarted?.Invoke(); action.RunAsync(); }
private void DeductStep() { isDeductStep = true; bool isSkillDeduct = FuncDeduct.Deduct(); fightUI.UpdateCollect(true, true); fightUI.UpdateCollect(false, true, isSkillDeduct); List <List <CellAnimInfo> > cellAnims = CellModel.Instance.anims; rootAction = new OrderAction(); for (int i = 0; i < cellAnims.Count; i++) { ParallelAction paralle = new ParallelAction(); List <CellAnimInfo> cellAnimss = cellAnims[i]; int j; for (j = 0; j < cellAnimss.Count; j++) { CellAnimInfo animInfo = cellAnimss[j]; FightCellItem item = GetItemByRunId(animInfo.runId); if (item != null) { OrderAction order = new OrderAction(); FightEffectItem effectItem = effectLayer.FindEffectItemByPos(animInfo.toInfo.posX, animInfo.toInfo.posY); order.AddNode(new ShowBombActor(item, effectItem)); order.AddNode(new WaitActor(300)); order.AddNode(new ShowBombActor(item, effectItem, false)); order.AddNode(new ChangeCellActor(item, animInfo.toInfo)); if (animInfo.toInfo.isBlank) { order.AddNode(new ShowEffectActor(item.transform, "effect_cell_clear", fightModule.transform)); order.AddNode(new DestroyActor(item.gameObject)); } paralle.AddNode(order); } } rootAction.AddNode(new PlaySoundActor("wreck")); rootAction.AddNode(paralle); } ExecuteAction(FightStadus.deduct); }
/** * Creates the gameState for the PatientScene */ protected override IList<GameState> GetGameStatesList() { //Gets the Dialog object from the camera for the dialog action DialogManager dialog = Camera.main.GetComponent<DialogManager>(); SoundManager soundManager = GameObject.Find ("SoundManager").GetComponent<SoundManager> (); GameObject obj = GameObject.Find ("Main Camera"); if (obj == null) { Debug.Log ("couldn't find Main Camera"); } soundManager.addSound (new Sound (obj, "Assets/backgroundMusic.mp3", "background")); //Inital parallel actions: the black screen and looping cell phone ringing IList<ActionRunner> startActionList = new List<ActionRunner> (); startActionList.Add (new FadeAction (true)); //Fade to black startActionList.Add (new SoundAction ("background", true)); ParallelAction startActions = new ParallelAction (startActionList); //Creates the Parallel Action list for the Shake State transition IList<ActionRunner> yesStateActionList = new List<ActionRunner> (); yesStateActionList.Add (new DialogAction ("Waking up", 3F)); ParallelAction shakeActions = new ParallelAction (yesStateActionList); if (dialog == null) { Debug.Log("null pointer with dialog"); } return new List<GameState> { new GameState( "start", new Dictionary<Trigger, string>() { {new NodTrigger(GameObject.Find("patient")), "shake"}, {new ShakeTrigger(GameObject.Find("patient")), "shake"} }, startActions ), new GameState( "shake", new Dictionary<Trigger, string>() { }, shakeActions, new FadeAction(true) //stop Fading to black ) }; }
public AnimeAction CreateHitDamageAction(Model targetModel, GameObject hitEffect = null) { ParallelAction hitDamagePack = new ParallelAction(); hitDamagePack.name = "HitDamage"; ModelHitAction hitAction = new ModelHitAction(); hitAction.name = "enemyHit"; hitAction.actor = targetModel; hitDamagePack.AddAction(hitAction); GameTextAction damageAction = new GameTextAction(); damageAction.textPrefab = damageTextPrefab; damageAction.text = 1000.ToString(); damageAction.spawnPostion = targetModel.transform.position + new Vector3(0, 2, -2); hitDamagePack.AddAction(damageAction); if (hitEffect == null) { return(hitDamagePack); } // EffectAction effectAction = EffectAction.CreatePointEffect(hitEffect, targetModel.GetPosition()); effectAction.onHitAction = hitDamagePack; return(effectAction); // SimpleAnimationAction effectAction = new SimpleAnimationAction(); // effectAction.clip = hitEffect; // effectAction.spawnPosition = targetModel.transform.position + new Vector3(0, 1, -2); // hitDamagePack.AddAction(effectAction); // } // return hitDamagePack; }
// Update is called once per frame void Update () { if (!started) { Debug.Log ("creating new sound action"); ActionRunner soundAction = new SoundAction ("chatter", false); ActionRunner soundAction2 = new SoundAction("happy", false); IList<ActionRunner> list = new List<ActionRunner> (); list.Add (soundAction); list.Add (soundAction2); ActionRunner parAction = new ParallelAction(list); list = new List<ActionRunner> (); list.Add (parAction); list.Add (parAction); ActionRunner seqAction = new SequentialAction(list); seqAction.Start (); started = true; } }
public void EffectCloud() { ParallelAction parallel = new ParallelAction(); int effectCount = 30; for (int i = 0; i < effectCount; i++) { float x = Random.Range(-4f, 4f); float y = Random.Range(-2f, 2f); Vector3 spawnPos = new Vector3(x, y, -5); EffectAction effectAction = EffectAction.CreatePointEffect(effectPrefab, spawnPos, null, 3); parallel.AddAction(effectAction); } actionManager.RunAction(parallel); }
public AnimeAction CreateProjectileAction(Model actor, Model target, GameObject projectile, GameObject hitEffect) { // Sequence: Projectile Movement, Hit Effect, ModelHit HitValue SequenceAction sequence = new SequenceAction(); Vector3 launchPos = actor.GetLaunchPosition(); Vector3 targetCenterPos = (Vector3)target.GetCenterPosition() + new Vector3(0, 0, -5); Vector3 targetPos = (Vector3)target.GetOriginPosition() + new Vector3(0, 0, -5); float duration = 0.5f; // Projectile Move EffectAction projectileAction = EffectAction.CreateProjectileEffect( projectile, launchPos, targetCenterPos, duration); sequence.AddAction(projectileAction); // Hit Effect ParallelAction damagePack = new ParallelAction(); sequence.AddAction(damagePack); EffectAction effectAction = EffectAction.CreatePointEffect(hitEffect, targetPos); damagePack.AddAction(effectAction); ModelHitAction hitAction = new ModelHitAction(); hitAction.name = "enemyHit"; hitAction.actor = target; damagePack.AddAction(hitAction); int damage = Random.Range(500, 10000); GameTextAction damageAction = GameTextAction.Create( damageTextPrefab, damage.ToString(), target.transform.position + new Vector3(0, 2, -2)); damagePack.AddAction(damageAction); return(sequence); }
// Update is called once per frame void Update() { if (!started) { Debug.Log("creating new sound action"); ActionRunner soundAction = new SoundAction("chatter", false); ActionRunner soundAction2 = new SoundAction("happy", false); IList <ActionRunner> list = new List <ActionRunner> (); list.Add(soundAction); list.Add(soundAction2); ActionRunner parAction = new ParallelAction(list); list = new List <ActionRunner> (); list.Add(parAction); list.Add(parAction); ActionRunner seqAction = new SequentialAction(list); seqAction.Start(); started = true; } }
private void Flow() { rootAction = new OrderAction(); if (!isDeductStep) { ParallelAction paralle = new ParallelAction(); floorLayer.Flow(paralle); if (coverFlowInterrupt == false) { coverLayer.Flow(paralle); } coverFlowInterrupt = false; rootAction.AddNode(paralle); } ExecuteAction(FightStadus.floor_flow); }
void DoFor(int iterations, ParallelAction action, Task task) { if (!m_Initialized) { Initialize(); } // No multithreaded support if (!m_Initialized) { for (var i = 0; i < iterations; ++i) { action(i); } return; } if (iterations == 0) { return; } var chunkSize = Mathf.Clamp(iterations / m_ThreadCount, 1, iterations); task.ResetTask(iterations, chunkSize, action); var id = 0; for (var i = 0; i < iterations; i += chunkSize) { var startIndex = id * chunkSize; var endIndex = Math.Min(startIndex + chunkSize, iterations); m_ActionQueue.Enqueue(() => DoTaskAction(task, startIndex, endIndex)); m_QueueIsNotEmptyEvent.Set(); ++id; } task.Wait(); }
public void ParallelDamage() { ParallelAction parallel = new ParallelAction(); GameTextAction action = new GameTextAction(); action.text = "123456"; action.textPrefab = hitPrefab; action.textStyle = GameText.Style.Damage; parallel.AddAction(action); action = new GameTextAction(); action.text = "123456"; action.textPrefab = hitPrefab; action.spawnPostion = new Vector3(2, 2, -3); action.textStyle = GameText.Style.Damage; parallel.AddAction(action); actionManager.RunAction(parallel); }
public void ParallelTest() { ParallelAction parallel = new ParallelAction(); parallel.name = "parallel"; //AnimatorAction action; HitValueAction hitAction; hitAction = new HitValueAction(); hitAction.valueTextPrefab = hitValuePrefab; hitAction.hitValue = 999; hitAction.position = new Vector3(0, 2, -2); parallel.AddAction(hitAction); hitAction = new HitValueAction(); hitAction.valueTextPrefab = hitValuePrefab; hitAction.hitValue = 888; hitAction.position = new Vector3(1, 1, -2); parallel.AddAction(hitAction); hitAction = new HitValueAction(); hitAction.valueTextPrefab = hitValuePrefab; hitAction.hitValue = 777; hitAction.position = new Vector3(2, 0, -2); parallel.AddAction(hitAction); DelayAction delay = new DelayAction(); delay.SetDuration(2.0f); parallel.AddAction(delay); // actionManager.RunAction(parallel); //action.animator = bat }
public AnimeAction CreateHitDamageAction(Model targetModel, GameObject hitEffect = null) { ParallelAction hitDamagePack = new ParallelAction(); hitDamagePack.name = "HitDamage"; ModelHitAction hitAction = new ModelHitAction(); hitAction.name = "enemyHit"; hitAction.actor = targetModel; hitDamagePack.AddAction(hitAction); GameTextAction damageAction = new GameTextAction(); damageAction.textPrefab = damageTextPrefab; damageAction.text = 1000.ToString(); damageAction.spawnPostion = targetModel.transform.position + new Vector3(0, 2, -2); hitDamagePack.AddAction(damageAction); if (hitEffect == null) { return(hitDamagePack); } // // Effect effect = hitEffect.GetComponent <Effect>(); PositionType posType = effect == null ? PositionType.Ground : effect.positionType; EffectAction effectAction = EffectAction.CreatePointEffect(hitEffect, targetModel.GetPositionByType(posType)); effectAction.onHitAction = hitDamagePack; return(effectAction); }
private void Invade() { rootAction = new OrderAction(); if (!isDeductStep) { ParallelAction paralle = new ParallelAction(); List <CellAnimInfo> invadeCells = InvadeModel.Instance.EffectInvade(); for (int i = 0; i < invadeCells.Count; i++) { ParallelAction paralleMove = new ParallelAction(); CellInfo fromCell = invadeCells[i].fromInfo; CellInfo toCell = invadeCells[i].toInfo; //Vector2 fromPos = PosUtil.GetFightCellPos(fromCell.posX, fromCell.posY); Vector2 toPos = PosUtil.GetFightCellPos(toCell.posX, toCell.posY); FightCellItem item = GetItemByRunId(toCell.runId); PosUtil.SetFightCellPos(item.transform, fromCell.posX, fromCell.posY); item.icon = toCell.config.icon; item.transform.localScale = new Vector3(0.5f, 0.5f, 1); OrderAction order1 = new OrderAction(); order1.AddNode(new PlaySoundActor("Refresh")); order1.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.2f)); paralleMove.AddNode(order1); OrderAction order2 = new OrderAction(); order2.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.15f)); paralleMove.AddNode(order2); paralle.AddNode(paralleMove); } rootAction.AddNode(paralle); } ExecuteAction(FightStadus.invade); }
void UpdateTime() { // Get current time int time = Mathf.CeilToInt(_time); if (time != _currentTime) { if (_currentTime > 0) { // Frame frame.StopAction(); frame.Show(); frame.Play(BlinkAction.Create(2, 0.3f, false, false), () => { frame.Hide(); }); // Play effect GameObject effect = numberEffect.gameObject; effect.StopAction(true); effect.Show(); effect.transform.localScale = Vector3.one; effect.SetColor(_currentTime > 3 ? Color.white : alarmColor, true); numberEffect.Number = _currentTime; var zoomOut = ScaleAction.ScaleTo(alarmScale, alarmDuration); var fadeOut = FadeAction.RecursiveFadeOut(alarmDuration); var hide = HideAction.Create(); effect.Play(SequenceAction.Create(ParallelAction.ParallelAll(zoomOut, fadeOut), hide)); } // Set current time _currentTime = time; // Update number number.Number = time; } }
private void buttonResolveAll_Click(object sender, EventArgs e) { List <AsyncAction> actions = new List <AsyncAction>(); foreach (DataGridViewRow row in dataGridView1.Rows) { PreCheckHostRow preCheckHostRow = row as PreCheckHostRow; if (preCheckHostRow != null && preCheckHostRow.Problem != null) { bool cancelled; AsyncAction action = preCheckHostRow.Problem.SolveImmediately(out cancelled); if (action != null) { actions.Add(action); } } } var multipleAction = new ParallelAction(Messages.PATCHINGWIZARD_PRECHECKPAGE_RESOLVING_ALL, Messages.PATCHINGWIZARD_PRECHECKPAGE_RESOLVING_ALL, Messages.COMPLETED, actions, true, false); _progressDialog = new ActionProgressDialog(multipleAction, ProgressBarStyle.Blocks); _progressDialog.ShowDialog(this); Program.Invoke(Program.MainWindow, RefreshRechecks); }
public void For(int iterations, ParallelAction action) { DoFor(iterations, action, m_TaskObject); }
private void Refresh(int waitmillisecond = 0, List <CellInfo> cells = null, FightStadus fightStadus = FightStadus.prop_refresh) { bool hasRefresh = false; rootAction = new OrderAction(); ParallelAction scale1 = new ParallelAction(); ParallelAction movos = new ParallelAction(); ParallelAction scale2 = new ParallelAction(); if (cells == null) { for (int i = 0; i < CellModel.Instance.allCells.Count; i++) { List <CellInfo> xCells = CellModel.Instance.allCells[i]; for (int j = 0; j < xCells.Count; j++) { CellInfo cellInfo = xCells[j]; CoverInfo coverInfo = CoverModel.Instance.GetCoverByPos(cellInfo.posY, cellInfo.posX); if (cellInfo.isBlank == false && cellInfo.config.cell_type == (int)CellType.five && coverInfo.IsNull()) { hasRefresh = true; FightCellItem item = GetItemByRunId(cellInfo.runId); if (fightStadus == FightStadus.changer) { item.transform.localRotation = Quaternion.identity; scale1.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 180), 0.2f)); } else { scale1.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.3f)); } if (fightStadus == FightStadus.changer) { scale2.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 360), 0.2f)); } else { Vector2 toPos = PosUtil.GetFightCellPos(cellInfo.posX, cellInfo.posY); movos.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.1f)); scale2.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.3f)); } } } } } else { for (int j = 0; j < cells.Count; j++) { CellInfo cellInfo = cells[j]; if (cellInfo.isBlank == false && cellInfo.config.cell_type == (int)CellType.five) { hasRefresh = true; FightCellItem item = GetItemByRunId(cellInfo.runId); if (fightStadus == FightStadus.changer) { item.transform.localRotation = Quaternion.identity; scale1.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 180), 0.2f)); } else { scale1.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.3f)); } if (fightStadus == FightStadus.changer) { scale2.AddNode(new RoatateActor((RectTransform)item.transform, new Vector3(0, 0, 360), 0.2f)); } else { Vector2 toPos = PosUtil.GetFightCellPos(cellInfo.posX, cellInfo.posY); movos.AddNode(new MoveActor((RectTransform)item.transform, new Vector3(toPos.x, toPos.y, 0), 0, 0.1f)); scale2.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(1, 1, 1), 0.3f)); } } } } if (waitmillisecond > 0) { rootAction.AddNode(new WaitActor(waitmillisecond)); } if (hasRefresh) { rootAction.AddNode(new PlaySoundActor("Refresh")); } rootAction.AddNode(scale1); rootAction.AddNode(movos); rootAction.AddNode(scale2); ExecuteAction(fightStadus); }
private void Crawl() { rootAction = new OrderAction(); if (!isDeductStep) { MonsterModel.Instance.Crawl(); List <MonsterCrawlInfo> crawAnims = MonsterModel.Instance.crawAnims; rootAction = new OrderAction(); ParallelAction paralle = new ParallelAction(); for (int i = 0; i < crawAnims.Count; i++) { MonsterCrawlInfo crawAnim = crawAnims[i]; OrderAction orderAction = new OrderAction(); paralle.AddNode(orderAction); FightMonsterItem monsterItem = monsterLayer.GetItemByRunId(crawAnim.monster.runId); for (int j = 0; j < crawAnim.pathCells.Count; j++) { CellInfo pathCell = crawAnim.pathCells[j]; Vector2 toPos = PosUtil.GetFightCellPos(pathCell.posX, pathCell.posY); float zrotate = 0; if (j > 0) { Vector2 fromPos = PosUtil.GetFightCellPos(crawAnim.pathCells[j - 1].posX, crawAnim.pathCells[j - 1].posY); zrotate = PosUtil.VectorAngle(new Vector2(fromPos.x, fromPos.y), new Vector2(toPos.x, toPos.y)); } else { Vector2 anchoredPos = ((RectTransform)monsterItem.transform).anchoredPosition; zrotate = PosUtil.VectorAngle(new Vector2(anchoredPos.x, anchoredPos.y), new Vector2(toPos.x, toPos.y)); } orderAction.AddNode(new RotationActor((RectTransform)monsterItem.transform, zrotate)); float speed = 600; orderAction.AddNode(new MoveActor((RectTransform)monsterItem.transform, new Vector3(toPos.x, toPos.y, 0), speed)); if (pathCell.isBlank == false) { FightCellItem cellItem = GetItemByRunId(pathCell.runId); pathCell.SetConfig((int)crawAnim.monster.releaseList[0].id); pathCell.changer = 0; orderAction.AddNode(new ChangeCellActor(cellItem, pathCell)); } } if (crawAnim.roadEnd) { orderAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(0, 0, 0), 0.3f)); orderAction.AddNode(new ChangeMonsterActor(monsterItem, crawAnim.monster)); } } rootAction.AddNode(paralle); } ExecuteAction(FightStadus.crawl); }
private void UnlockMonster(bool isJet = false) { List <int> unLockIds = MonsterModel.Instance.UnLock(isJet); MonsterModel.Instance.BackUpUnLockMonster(unLockIds); rootAction = new OrderAction(); for (int j = 0; j < unLockIds.Count; j++) { int monsterRunId = unLockIds[j]; FightMonsterItem monsterItem = monsterLayer.GetItemByRunId(monsterRunId); rootAction.AddNode(new SetLayerActor(monsterItem.transform, effectLayer.transform)); CellInfo monsterCell = new CellInfo(); monsterCell.posX = monsterItem.monsterInfo.posX; monsterCell.posY = monsterItem.monsterInfo.posY; if (isJet) { if (monsterItem.monsterInfo.IsNull()) { CellDirType dirType = WallModel.Instance.GetGapWallDir(monsterCell); int zrotate = PosUtil.GetRotateByDir(dirType); rootAction.AddNode(new RoatateActor((RectTransform)monsterItem.transform, new Vector3(0, 0, zrotate), 0.25f)); } else { rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(1.15f, 1.15f, 1f), 0.2f)); } } List <CellInfo> releaseList = MonsterModel.Instance.ReleaseList(monsterRunId); if (releaseList.Count > 0) { ParallelAction paralle = new ParallelAction(); for (int i = 0; i < releaseList.Count; i++) { CellInfo cellInfo = releaseList[i]; FightCellItem item = GetItemByRunId(cellInfo.runId); if (item == null) { GameObject itemObj = CreateCellItem(cellInfo); item = itemObj.GetComponent <FightCellItem>(); } OrderAction order = new OrderAction(); order.AddNode(new PlaySoundActor("Refresh")); order.AddNode(new ShowEffectLineActor(effectLayer, cellInfo, monsterCell, monsterItem.monsterInfo.releaseId)); order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.1f)); order.AddNode(new ChangeCellActor(item, cellInfo, monsterItem.monsterInfo.releaseId)); paralle.AddNode(order); } rootAction.AddNode(paralle); } if (monsterItem.monsterInfo.IsNull()) { rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(1.25f, 1.25f, 0), 0.15f)); if (j == 0) { rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(0, 0, 0), 0.25f)); } else { rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(0, 0, 0), 0.15f)); } } else { rootAction.AddNode(new ScaleActor((RectTransform)monsterItem.transform, new Vector3(1, 1, 1), 0.05f)); CoverInfo coverInfo = CoverModel.Instance.GetCoverByPos(monsterItem.monsterInfo.posY, monsterItem.monsterInfo.posX); FightCoverItem coverItem = coverLayer.GetItemByRunId(coverInfo.runId); rootAction.AddNode(new ChangeCoverActor(coverLayer, coverItem, coverInfo)); rootAction.AddNode(new ProgressMonsterActor(monsterItem, monsterItem.monsterInfo.progress)); rootAction.AddNode(new SetLayerActor(monsterItem.transform, monsterLayer.transform)); } } if (isJet) { ExecuteAction(FightStadus.jet_monster); } else { ParallelAction paralleTimer = new ParallelAction(); List <CellInfo> timerCells = CellModel.Instance.Timing(); for (int i = 0; i < timerCells.Count; i++) { CellInfo cellInfo = timerCells[i]; FightCellItem item = GetItemByRunId(cellInfo.runId); if (item != null) { OrderAction order = new OrderAction(); order.AddNode(new PlaySoundActor("Refresh")); order.AddNode(new ChangeCellActor(item, cellInfo)); if (cellInfo.isBlank) { order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.2f)); order.AddNode(new DestroyActor(item.gameObject)); } paralleTimer.AddNode(order); } } List <CoverInfo> timerCovers = CoverModel.Instance.Timing(); for (int i = 0; i < timerCovers.Count; i++) { CoverInfo coverInfo = timerCovers[i]; FightCoverItem item = coverLayer.GetItemByRunId(coverInfo.runId); OrderAction order = new OrderAction(); order.AddNode(new PlaySoundActor("Refresh")); order.AddNode(new ChangeCoverActor(coverLayer, item, coverInfo)); if (coverInfo.IsNull()) { order.AddNode(new ScaleActor((RectTransform)item.transform, new Vector3(0, 0, 0), 0.2f)); order.AddNode(new DestroyActor(item.gameObject)); List <CoverInfo> covers = CoverModel.Instance.GetNeighbors(coverInfo); for (int n = 0; n < covers.Count; n++) { CoverInfo cover = covers[n]; if (cover != null) { item = coverLayer.GetItemByRunId(cover.runId); order.AddNode(new ChangeCoverActor(coverLayer, item, cover)); if (cover.config != null) { coverFlowInterrupt = true; } } } } paralleTimer.AddNode(order); } rootAction.AddNode(paralleTimer); if (coverFlowInterrupt) { rootAction.AddNode(new FuncActor(coverLayer.ShowList)); //todo 爆后流动导致多出蜘蛛网 } ExecuteAction(FightStadus.unlock_monster); } }
/** * Creates the gameState for the scene */ protected override IList<GameState> GetGameStatesList() { //Gets the Dialog object from the camera for the dialog action DialogManager dialog = Camera.main.GetComponent<DialogManager>(); SoundManager soundManager = GameObject.Find ("SoundManager").GetComponent<SoundManager> (); GameObject obj = GameObject.FindGameObjectWithTag ("MainCamera"); if (obj == null) { Debug.LogError ("couldn't find Main Camera"); } soundManager.addSound (new Sound (obj, "Assets/Sounds/backgroundMusic.mp3", "background")); soundManager.addSound (new Sound (obj, "Assets/Sounds/crowd-talking-1.mp3", "chatter")); soundManager.addSound (new Sound (obj, "Assets/Sounds/sadMusic.mp3", "sadMusic")); //Creates the Parallel Action list for the Yes State transition IList<ActionRunner> yesStateActionList = new List<ActionRunner> (); yesStateActionList.Add (new DialogAction ("Currently at the yes state", 3F)); yesStateActionList.Add (new SoundAction ("background", false)); ParallelAction yesActions = new ParallelAction (yesStateActionList); //Creates the Parallel Action list for the No State transition IList<ActionRunner> noStateActionList = new List<ActionRunner> (); noStateActionList.Add (new DialogAction ("Currently at the no state", 3F)); noStateActionList.Add (new SoundAction ("chatter", false)); noStateActionList.Add (new CameraInvertAction ()); ParallelAction noActions = new ParallelAction (noStateActionList); //Creates the Parallel Action list for the Stare State transition IList<ActionRunner> stareStateActionList = new List<ActionRunner> (); stareStateActionList.Add (new DialogAction ("Currently at the Stare State", 3F)); stareStateActionList.Add (new SoundAction ("sadMusic", false)); ParallelAction stareActions = new ParallelAction (stareStateActionList); if (dialog == null) { Debug.Log("null pointer with dialog"); } return new List<GameState> { new GameState( "start", new Dictionary<Trigger, string>() { {new NodTrigger(GameObject.Find("patient")), "yes"}, {new ShakeTrigger(GameObject.Find("patient")), "no"}, {new StareTrigger(GameObject.Find("patient"), "StareTarget"), "stare"} }, new DialogAction("Currently at the start state", 3F) ), new GameState( "no", new Dictionary<Trigger, string>(), noActions ), new GameState( "yes", new Dictionary<Trigger, string>(), yesActions ), new GameState( "stare", new Dictionary<Trigger, string>(), stareActions ) }; }
/** * Creates the gameState for the scene */ protected override IList<GameState> GetGameStatesList() { //Gets the Dialog object from the camera for the dialog action DialogManager dialog = Camera.main.GetComponent<DialogManager>(); GameObject patient = GameObject.Find ("patient"); SoundManager soundManager = GameObject.Find ("SoundManager").GetComponent<SoundManager> (); GameObject obj = GameObject.FindGameObjectWithTag ("MainCamera"); if (obj == null) { Debug.LogError ("couldn't find Main Camera"); } soundManager.addSound (new Sound (obj, "Assets/Sounds/surreal_sound1.mp3", "surreal1")); soundManager.addSound (new Sound (GameObject.FindGameObjectWithTag ("MainCamera"), "Assets/Sounds/gibberish.mp3", "gibberish")); ActionRunner scene3HallucinateAction = new ParallelAction( new List<ActionRunner>() { new CameraInvertAction(), new LightPulseAction(), //TODO: Corey also sound affect new SoundAction("surreal1", true) } ); GameState scene3Hallucinate = new GameState ( "scene3Hallucinate", new Dictionary<Trigger, string> { {new ShakeTrigger(patient), "scene3RoseDialog"} }, scene3HallucinateAction ); ActionRunner scene3RoseDialogAction = new SequentialAction ( new List<ActionRunner>(){ new DialogAction("Whoa, what are you doing?"), new DialogAction("You okay?"), new DialogAction("I hope the flower Mom brought actually works"), new DialogAction("I mean, it does mean \"get-well-soon\""), } ); GameState scene3RoseDialog = new GameState ( "scene3RoseDialog", new Dictionary<Trigger, string> () { {new MainActionFinishedTrigger(), "scene3Rose"} }, scene3RoseDialogAction, scene3HallucinateAction ); GameState scene3Rose = new GameState( "scene3Rose", new Dictionary<Trigger, string> () { {new StareTrigger(patient, "rose"), "scene3Story"} }, new NoAction() ); ActionRunner scene3StoryAction = new SequentialAction (new List<ActionRunner> (){ new DialogAction("They weren't originally blue; they were red."), new DialogAction("Some people wanted to clone roses to see if they could breed them " + "true and get a reliable variety they could stock and sell."), new DialogAction("For some reason, " + "they got brown flowers instead of the red ones they wanted so they were about to stop " + "the funding, but they finally tried cloning the brown roses."), new DialogAction("The next clones were blue " + "and bred true enough for commercial purposes."), new DialogAction("The thing is, everyone wasn't too bothered " + "about roses being cloned, but when they moved the project to animals from roses, " + "that was when it went to hell."), new DialogAction("See, after the whole thing with the roses, there were ideas " + "to fix the underpopulation problem with cloning, but there was a crowd of people against " + "it."), new DialogAction("It was risky and unreliable, actually, the whole roses debacle was really a lucky bit."), new DialogAction("Mom is against it, as a matter of fact —it's why you two got into fights.") }); GameState scene3Story = new GameState ( "scene3Story", new Dictionary<Trigger, string>(), scene3StoryAction ); return new List<GameState> { scene3Hallucinate, scene3RoseDialog, scene3Rose, scene3Story }; }
IList<GameState> GetScene2List() { //Gets the Dialog object from the camera for the dialog action DialogManager dialog = Camera.mainCamera.GetComponent<DialogManager>(); SoundManager soundManager = GameObject.Find ("SoundManager").GetComponent<SoundManager> (); GameObject person = GameObject.Find ("person"); soundManager.addSound (new Sound ("Assets/Sounds/surreal_sound4.mp3", "surrealSound")); GameObject obj = GameObject.Find ("Main Camera"); if (obj == null) { Debug.Log ("couldn't find Main Camera"); } ParallelAction hallu = new ParallelAction (new CameraInvertAction(), new SoundAction("surrealSound", true)); SequentialAction visitor = new SequentialAction ( new ChildSelectorAction("Sibling", "normalpose"), new DialogAction("Sibling: I’m glad to see you’re awake."), new DialogAction("Sibling: We’re in St. Paul’s Hospital which works with Lydersen Labs to develop pharmaceuticals."), new DialogAction("Sibling: Actually, I work here, but in the research side with people from Lydersen.") ); DialogAction WorldExpo = new DialogAction ("I’m your brother. Uh, I don’t know what to say… I work here and, \n" + "um, I do research in epigenetics. \n" + "This never happened before… I didn’t think that — the doctor did say you might…"); if (dialog == null) { Debug.Log("null pointer with dialog"); } return new List<GameState> { new GameState( "hallucination", new Dictionary<Trigger, string>() { {new NodTrigger(), "Visitor"} },hallu ), new GameState( "Visitor", new Dictionary<Trigger, string>() { {new MainActionFinishedTrigger(), "question1Prompt"} }, visitor, hallu ), new GameState( "question1Prompt", new Dictionary<Trigger, string>(){{new MainActionFinishedTrigger(), "question1"}}, new SequentialAction(new DialogAction("Sibling: We were really worried we were going to lose you, and there’s barely enough people around as it is…"), new DialogAction("Sibling: Do you remember your name?")) ), new GameState( "question1", new Dictionary<Trigger, string>(){ {new NodTrigger(), "question2prompt"}, {new ShakeTrigger(), "question3prompt"} }, new NoAction() ), new GameState( "question2prompt", new Dictionary<Trigger, string>(){{new MainActionFinishedTrigger(), "question2"}}, new DialogAction("Sibling: See, I knew the doctor was worrying too much. In that case, you remember me, right?") ), new GameState( "question2", new Dictionary<Trigger, string>(){ {new NodTrigger(), "scene3Hallucinate"}, {new ShakeTrigger(), "question2No"} }, new NoAction() ), new GameState( "question2No", new Dictionary<Trigger, string>(){{new MainActionFinishedTrigger(), "WorldExpo"}}, new DialogAction("I- um. I, well") ), new GameState( "question3prompt", new Dictionary<Trigger, string>(){{new MainActionFinishedTrigger(), "question3"}}, new DialogAction("Sibling: Wait, really? But that — In that case, do you remember me?") ), new GameState( "question3", new Dictionary<Trigger, string>(){ {new NodTrigger(), "question3Yes"}, {new ShakeTrigger(), "question2No"} }, new NoAction() ), new GameState( "question3Yes", new Dictionary<Trigger, string>(){{new MainActionFinishedTrigger(), "scene3Hallucinate"}}, new DialogAction("Sibling: But then, how do — no, nevermind.") ), new GameState( "WorldExpo", new Dictionary<Trigger, string>() { {new MainActionFinishedTrigger(), "scene3Hallucinate"}, }, WorldExpo ) }; }
void DoFor(int iterations, ParallelAction action, Task task) { if (!m_Initialized) Initialize(); // No multithreaded support if (!m_Initialized) { for (var i = 0; i < iterations; ++i) action(i); return; } if (iterations == 0) return; var chunkSize = Mathf.Clamp(iterations/m_ThreadCount, 1, iterations); task.ResetTask(iterations, chunkSize, action); var id = 0; for (var i = 0; i < iterations; i += chunkSize) { var startIndex = id*chunkSize; var endIndex = Math.Min(startIndex + chunkSize, iterations); m_ActionQueue.Enqueue(() => DoTaskAction(task, startIndex, endIndex)); m_QueueIsNotEmptyEvent.Set(); ++id; } task.Wait(); }
private void PlayPutAutoSkill() { rootAction = new OrderAction(); WaitActor waitActor = new WaitActor(200); rootAction.AddNode(waitActor); List <SkillEntityInfo> skillEntitys = SkillModel.Instance.GetNewSkillEntitys(); fightUI.ShowSkill(); if (lastTouchCell != null && skillEntitys.Count > 0) { ParallelAction parallelAction = new ParallelAction(); int holdIndex = 0; bool lastIsHump = lastTouchCell.IsHump(); for (int i = 0; i < skillEntitys.Count; i++) { OrderAction skillOrder = new OrderAction(); SkillEntityInfo skillEntity = skillEntitys[i]; Vector2 addPos = new Vector2(); for (int h = holdIndex; h < 19; h++) { Vector2 holePos = FightConst.GetHoleByLevel(h, lastIsHump); Vector2 checkPos = new Vector2(lastTouchCell.posX + holePos.x, lastTouchCell.posY - holePos.y); CellInfo checkCell = CellModel.Instance.GetCellByPos((int)checkPos.x, (int)checkPos.y); if (checkCell != null && checkCell.isBlank) { addPos = checkPos; holdIndex = h + 1; break; } } CellInfo addItem = CellModel.Instance.AddItem(skillEntity.seed.config_cell_item.id, (int)addPos.x, (int)addPos.y); SkillModel.Instance.ThrowSkillEntity(skillEntity, addItem); GameObject itemObj = CreateCellItem(addItem); itemObj.transform.SetParent(effectLayer.transform, false); Vector2 toPos = PosUtil.GetFightCellPos(addItem.posX, addItem.posY); PosUtil.SetCellPos(itemObj.transform, skillEntity.seed.seed_x, skillEntity.seed.seed_y, 1.0f); rootAction.AddNode(new PlaySoundActor("Useskill")); rootAction.AddNode(new ShowEffectActor(itemObj.transform, "effect_skill_fly")); rootAction.AddNode(new MoveActor((RectTransform)itemObj.transform, new Vector3(toPos.x, toPos.y, 0), 1200)); skillOrder.AddNode(new SetLayerActor(itemObj.transform, transform)); skillOrder.AddNode(new PlaySoundActor("PutAutoSkill")); skillOrder.AddNode(new ClearEffectActor(itemObj.transform, "effect_skill_fly")); skillOrder.AddNode(new ScaleActor((RectTransform)itemObj.transform, new Vector3(1.2f, 1.2f, 0), 0.2f)); skillOrder.AddNode(new ScaleActor((RectTransform)itemObj.transform, new Vector3(1, 1, 0), 0.1f)); parallelAction.AddNode(skillOrder); } rootAction.AddNode(parallelAction); } waitActor = new WaitActor(200); rootAction.AddNode(waitActor); ExecuteAction(FightStadus.auto_skill); }
/** * Creates the gameState for the PatientScene */ protected override IList<GameState> GetGameStatesList() { //Gets the Dialog object from the camera for the dialog action DialogManager dialog = Camera.mainCamera.GetComponent<DialogManager>(); SoundManager soundManager = GameObject.Find ("SoundManager").GetComponent<SoundManager> (); AnimationManager animationManager = GameObject.Find ("animationManager").GetComponent<AnimationManager> (); GameObject person = GameObject.Find ("person"); AnimationClip animation = person.GetComponent<Animation> ().GetClip ("Take 001"); soundManager.addSound (new Sound (person, "Assets\\surreal sounds 4.mp3", "surrealSound")); GameObject obj = GameObject.Find ("Main Camera"); if (obj == null) { Debug.Log ("couldn't find Main Camera"); } List<ActionRunner> surrealEffects = new List<ActionRunner> (); surrealEffects.Add (new CameraInvertAction()); surrealEffects.Add (new SoundAction("surrealSound", true)); ParallelAction hallu = new ParallelAction (surrealEffects); List<ActionRunner> list = new List<ActionRunner> (); list.Add (new DialogAction ("How long have you been awake? Uh, actually, first, do you know where you are?")); SequentialAction visitor = new SequentialAction (list); DialogAction no1 = new DialogAction ("Well, we’re in St. Paul’s Hospital. It works with Lydersen Labs to develop pharmaceuticals. " + "Actually, I work here, but in the research side with people from Lydersen."); DialogAction yes1 = new DialogAction ("Oh, okay, that’s good."); DialogAction no2 = new DialogAction ("That’s fine, I’m just glad you’re okay. You got " + "hit by a car. I don’t know exactly what happened, but you’ve been in a coma for a while."); DialogAction yes2 = new DialogAction ("Yeah, that was a pretty bad crash. We were worried you wouldn’t make it."); DialogAction preDoctorQs = new DialogAction ("Okay, you should remember who you are, right? " + "The doctor gave me these questions to ask you, just making sure you’re all here."); DialogAction no3 = new DialogAction ("Wait, really? But that — In that case, do you remember me? "); DialogAction yes3 = new DialogAction ("See, I knew the doctor was worrying too much. In that case, you remember me, right?"); DialogAction no4 = new DialogAction ("I- um. I, well."); DialogAction yes4 = new DialogAction ("But then, how do — no, nevermind."); DialogAction WorldExpo = new DialogAction ("I’m your brother. Uh, I don’t know what to say… I work here and, \n" + "um, I do research in epigenetics. \n" + "This never happened before… I didn’t think that — the doctor did say you might…"); DialogAction question2 = new DialogAction ("Do you remember anything about how you got here?"); NodTrigger nodTrigger = new NodTrigger (obj); ShakeTrigger shakeTrigger = new ShakeTrigger (obj); if (dialog == null) { Debug.Log("null pointer with dialog"); } return new List<GameState> { new GameState( "hallucination", new Dictionary<Trigger, string>() { {shakeTrigger, "Visitor"} },hallu ), new GameState( "Visitor", new Dictionary<Trigger, string>() { {new MainActionFinishedTrigger(), "QATime1"} }, visitor, hallu ), new GameState( "QATime1", new Dictionary<Trigger, string>() { {shakeTrigger, "no1"}, {nodTrigger, "yes1"} }, new NoAction() ), new GameState( "no1", new Dictionary<Trigger, string>() { {new MainActionFinishedTrigger(), "question2"} }, no1 ), new GameState( "yes1", new Dictionary<Trigger, string>() { {new MainActionFinishedTrigger(), "question2"} }, yes1 ), new GameState( "question2", new Dictionary<Trigger, string>() { {new MainActionFinishedTrigger(), "QATime2"} }, question2 ), new GameState( "QATime2", new Dictionary<Trigger, string>() { {shakeTrigger, "no2"}, {nodTrigger, "yes2"} }, new NoAction() ), new GameState( "no2", new Dictionary<Trigger, string>() { {new MainActionFinishedTrigger(), "question3"} }, no2 ), new GameState( "yes2", new Dictionary<Trigger, string>() { {new MainActionFinishedTrigger(), "question3"} }, yes2 ), new GameState( "question3", new Dictionary<Trigger, string>() { {new MainActionFinishedTrigger(), "preQATime3"} }, preDoctorQs ), new GameState( "preQATime3", new Dictionary<Trigger, string>() { {shakeTrigger, "question4_no"}, {nodTrigger, "question4_yes"} }, new NoAction() ), new GameState( "question4_no", new Dictionary<Trigger, string>() { {new MainActionFinishedTrigger(), "no3"} }, no3 ), new GameState( "no3", new Dictionary<Trigger, string>() { {shakeTrigger, "no4"}, {nodTrigger, "Scene3"} }, new NoAction() ), new GameState( "question4_yes", new Dictionary<Trigger, string>() { {new MainActionFinishedTrigger(), "yes3"} }, yes3 ), new GameState( "yes3", new Dictionary<Trigger, string>() { {shakeTrigger, "no4"}, {nodTrigger, "yes4"} }, new NoAction() ), new GameState( "no4", new Dictionary<Trigger, string>() { {new MainActionFinishedTrigger(), "WorldExpo"}, }, no4 ), new GameState( "yes4", new Dictionary<Trigger, string>() { {new MainActionFinishedTrigger(), "WorldExpo"}, }, yes4 ), new GameState( "WorldExpo", new Dictionary<Trigger, string>() { {new MainActionFinishedTrigger(), "Scene3"}, }, WorldExpo ), new GameState( "Scene3", new Dictionary<Trigger, string>() { }, new NoAction() ) }; }