private void OnMouseDown() { float dist = Vector3.Distance(player.position, transform.position); if (dist <= 15 && !isTalking) { if (!butterKeyOpen) { talkFlowchart.ExecuteBlock(talkFlowchart.FindBlock("noReaction")); } else { Block targetBlock = talkFlowchart.FindBlock(onMouseDown); talkFlowchart.ExecuteBlock(targetBlock); doorANum1.red.SetActive(false); doorANum1.blue.SetActive(false); doorANum1.green.SetActive(false); doorANum1.yellow.SetActive(false); doorANum2.red.SetActive(false); doorANum2.blue.SetActive(false); doorANum2.green.SetActive(false); doorANum2.yellow.SetActive(false); doorANum3.red.SetActive(false); doorANum3.blue.SetActive(false); doorANum3.green.SetActive(false); doorANum3.yellow.SetActive(false); doorANum4.red.SetActive(false); doorANum4.blue.SetActive(false); doorANum4.green.SetActive(false); doorANum4.yellow.SetActive(false); } } }
void callFlowchartBlock() { bool inEXAMornot = flowchart.GetBooleanVariable("InExam"); if (inEXAMornot == true) { int nowproblem = flowchart.GetIntegerVariable("CurrentProblem"); nowproblem = nowproblem - 4; if (nowproblem == 9) { Block target = flowchart.FindBlock("SCORE"); flowchart.ExecuteBlock(target); } else { string targetname = "Q" + nowproblem; Block target = flowchart.FindBlock(targetname); flowchart.ExecuteBlock(target); } } else { int ChapNum = flowchart.GetIntegerVariable("CurrentChap"); int ProblemNum = flowchart.GetIntegerVariable("ChapProblem"); string targetname = "ansFeedback" + ChapNum + "-" + ProblemNum; Block target = flowchart.FindBlock(targetname); flowchart.ExecuteBlock(target); } }
public void OnPointerDown(PointerEventData eventData) { if (DB.window_mode) { if (DB.window_left) { DB.window_mode = false; DB.show = false; if (DB.getgameboy && DB.bag_Object [int.Parse(DB.Bag_position) - 1] != "gameboy" && DB.bag_Object [int.Parse(DB.Bag_position) - 1] == "piano") { DB.cango = false; Block targetBlock = talkflowchart.FindBlock("knife"); talkflowchart.ExecuteBlock(targetBlock); for (int i = int.Parse(DB.Bag_position) - 1; i < 20; i++) { if (i == 19) { DB.bag_Object [i] = ""; } else { DB.bag_Object [i] = DB.bag_Object [i + 1]; } } for (int i = 0; i < 20; i++) { if (DB.bag_Object [i] == "gameboy") { DB.bag_Object [i] = "knife"; } } //DB.backpack_mode = false; //這邊要加判斷 物件是否會成功使用,成功就跳回,失敗就留在背包 //SceneManager.LoadScene (DB.pre_scense); DB.knife = true; StartCoroutine(WaitAndPrint(1.0f)); } else { DB.cango = false; Block targetBlock = talkflowchart.FindBlock("nothing"); talkflowchart.ExecuteBlock(targetBlock); } } else { DB.window_mode = false; DB.show = false; } } }
void GetStroy() { Block levelBlock = flowchartManager.FindBlock(level); if (levelBlock != null) { flowchartManager.ExecuteBlock(levelBlock); } else { Skip(); } }
// Use this for initialization void Start() { if (DB.startgame1) { if (Application.loadedLevel == 2) { flowchartManager = GameObject.Find("speakcontrol2").GetComponent <Flowchart> (); } DB.cango = false; Block targetBlock = talkflowchart.FindBlock("start"); talkflowchart.ExecuteBlock(targetBlock); Block targetBlock2 = talkflowchart.FindBlock("start2"); talkflowchart.ExecuteBlock(targetBlock2); DB.startgame1 = false; } }
public override void OnEnter() { flow.FindBlock(blockName).GetComponent <FungusPlayImageDescription>().audioName = audioN; //audioBtn.GetComponent<FungusPlayImageDescription>().audioName = audioN; //Debug.Log("aqui"); Continue(); }
// Update is called once per frame void Update() { //用于判断主角是否碰到武器店的商人 GameObject[] obj = GameObject.FindGameObjectsWithTag("Player"); for (int i = 0; i < obj.Length; i++) { Vector3 dir = obj[i].transform.position - transform.position; if (dir.magnitude < distanceArriveTarget) { if (!flag) { flag = true; Block target = talkFlowchart.FindBlock(onCollision); talkFlowchart.ExecuteBlock(target); KnapsackManager.Instance.StoreItem(4); KnapsackManager.Instance.StoreItem(5); KnapsackManager.Instance.StoreItem(6); return; } } else { return; } } }
public override void OnEnter() { Block targetBlock = flowchart.FindBlock(blockName.Value); flowchart.ExecuteBlock(targetBlock); Finish(); }
/// <summary> /// Makes the blocks in the flowchart pick up where they left off, when the original /// FlowchartData was made. /// </summary> protected virtual void LoadExecutingBlocks(FlowchartData data, Flowchart flowchart) { flowchart.StopAllBlocks(); for (int i = 0; i < data.Blocks.Count; i++) { var savedBlock = data.Blocks[i]; if (!savedBlock.WasExecuting) { continue; } var fullBlockObj = flowchart.FindBlock(savedBlock.BlockName); if (fullBlockObj == null) { // Seems the user removed the block. Might as well let them know. var messageFormat = @"Could not load state of block named {0} from flowchart named {1}; the former is not in the latter."; var message = string.Format(messageFormat, savedBlock.BlockName, flowchart.name); Debug.LogWarning(message); continue; } flowchart.ExecuteBlock(fullBlockObj, savedBlock.CommandIndex); } }
private void OnMouseDown() { float dist = Vector3.Distance(player.position, transform.position); if (dist <= 30 && !isTalking) { if (!butterflyMachine.butterMachineOpen) { talkFlowchart.ExecuteBlock(talkFlowchart.FindBlock("noReaction")); } else { if (!butterflyOnSpecimen) { butterflyChart.ExecuteBlock("goldenButterfly"); butterflyOnSpecimen = true; } else { if (!purpleBasin) { butterflyChart.ExecuteBlock("goldenButterfly2"); } else { butterflyChart.ExecuteBlock("makeButterSpecimen"); butterflyInSpecimen = true; } } } } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Player")) { Block targetBlk = dialogue.FindBlock(dialogueStr); dialogue.ExecuteBlock(targetBlk); } }
private void OnCollisionEnter(Collision other) { if (other.gameObject.CompareTag("Player")) { Block target = talkFlowchart.FindBlock(onCollision); talkFlowchart.ExecuteBlock(target); } }
private void OnTriggerStay(Collider other) { near = true; Block targetBlock = StageFlowchart.FindBlock(stage); StageFlowchart.ExecuteBlock(targetBlock); }
private void OnCollisionEnter2D(UnityEngine.Collision2D collision) {//when player attach NPC it will targeting the block in flowchart to start the dialog if (collision.gameObject.CompareTag("player")) { Block targetBlock = talkFlowchart.FindBlock(onCollosionEnter); talkFlowchart.ExecuteBlock(targetBlock); } }
private void OnMouseDown() { float dist = Vector3.Distance(player.position, transform.position); if (dist <= 30 && !isTalking) { if (nineButton.finalSuccess == false) { talkFlowchart.ExecuteBlock(talkFlowchart.FindBlock("noReaction")); } else { Block targetBlock = talkFlowchart.FindBlock(onMouseDown); talkFlowchart.ExecuteBlock(targetBlock); } } }
private void OnMouseDown() { float dist = Vector3.Distance(player.position, transform.position); if (dist <= 30 && !isTalking) { if (spiderLocker.spiderKeyOpen == false) { talkFlowchart.ExecuteBlock(talkFlowchart.FindBlock("noReaction")); } else { Block targetBlock = talkFlowchart.FindBlock(onMouseDown); talkFlowchart.ExecuteBlock(targetBlock); } } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { Block targetBlock = talkFlowchart.FindBlock(select); talkFlowchart.ExecuteBlock(targetBlock); } Destroy(GameObject.FindGameObjectWithTag("justACube")); }
private void OnTriggerStay(Collider other) { near = true; if (Input.GetKeyDown(KeyCode.F)) { Block targetBlock = talkFlowchart.FindBlock(NPC); talkFlowchart.ExecuteBlock(targetBlock); } }
private void Update() { if (!doorBOne.up && !doorBTwo.up && doorBThree.up && !doorBFour.up && !doorBFive.up && !doorBSix.up && doorBSeven.up && !doorBEight.up && doorBNine.up && doorBZero.up && finish == false) { talkFlowchart.ExecuteBlock(talkFlowchart.FindBlock("finalTrapOpen")); finish = true; } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { //玩家进入对话范围触发对话 targetBlock = talkFlowchart.FindBlock(onTalkZone); talkFlowchart.ExecuteBlock(targetBlock); } }
private void OnCollisionEnter(UnityEngine.Collision other) { if (other.gameObject.CompareTag("player")) { playerRigigbody.Sleep(); Block targetBlock = talkFlowchart.FindBlock(onCollosionEnter); talkFlowchart.ExecuteBlock(targetBlock); } }
private void OnMouseDown() { float dist = Vector3.Distance(player.position, transform.position); if (dist <= 30 && purpleBasin) { talkFlowchart.ExecuteBlock(talkFlowchart.FindBlock("purpleBasinSay")); } }
private void OnMouseDown() { float dist = Vector3.Distance(player.position, transform.position); if (dist <= 15 && !isTalking && beetleTimes == 0) { Block targetBlock = talkFlowchart.FindBlock(onMouseDown); talkFlowchart.ExecuteBlock(targetBlock); } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { string targetname = this.gameObject.name; Block targetBlock = flowchart.FindBlock(targetname); flowchart.ExecuteBlock(targetBlock); flowchart.ExecuteBlock("Talking"); } }
public void itemUse() { //使用道具的分歧編號,0代表找不到相應的使用地點 int useItemRole = (SurveyJudge.ItemUseMap.ContainsKey(transform.name)) ? SurveyJudge.ItemUseMap[transform.name] : 0; itemUseFlowchart.SetIntegerVariable("useItemRole", useItemRole);//設置分歧編號 //進入統一使用道具的入口 Block enterBlock = itemUseFlowchart.FindBlock("UseItem_Enter"); itemUseFlowchart.ExecuteBlock(enterBlock); }
private void OnMouseDown() { float dist = Vector3.Distance(player.position, transform.position); if (dist <= 30 && !isTalking) { if (canOpenPower) { labLight.SetActive(true); // false to hide, true to show Block targetBlock = talkFlowchart.FindBlock(onMouseDown); talkFlowchart.ExecuteBlock(targetBlock); isLight = true; } else { Block targetBlock = talkFlowchart.FindBlock("noReaction"); talkFlowchart.ExecuteBlock(targetBlock); } } }
public bool ExecuteBlock(string blockName, Action onComplete = null) { var block = _flowchart.FindBlock(blockName); if (block == null) { return(false); } block.Stop(); return(_flowchart.ExecuteBlock(block, 0, onComplete)); }
// делаем меню вариантов ответа на базе диалога MenuDialog из Fungus'a private IEnumerator ReplikMenu(Person Pers, string[] text) { while (SayBlockExecution) { yield return(null); } if (!SayBlockExecution) { ShowForm(FormList.Branch_List, 0); ShowSayMenu(true); string s; for (int i = 0; i < text.Length; i++) { s = "AskMain" + (i + 1); LongList.AddOption(text[i], true, Flow.FindBlock(s)); // ищем заранее созданные блоки } SayBlockExecution = true; } }
void Start() { if (pcontrol != null) { if (pcontrol.GetIntegerVariable("keyPress") != 0) { if (pcontrol.FindBlock("UpdatePress") != null) { safe = true; } } } }
private void OnMouseDown() { float dist = Vector3.Distance(player.position, transform.position); if (dist <= 30) { if (!blueBasin && !redBasin) { talkFlowchart.ExecuteBlock(talkFlowchart.FindBlock("openBlueBasin")); blueBasinMed.SetActive(true); } else { if (redBasin) { talkFlowchart.ExecuteBlock(talkFlowchart.FindBlock("openPurpleBasin")); purpleBasinMed.SetActive(true); redBasinMed.SetActive(false); } } } }