// Update is called once per frame void Update() { if (!Global.StopTouch && Shop != null && MtShip1 != null) { if (Bread && Vector3.Distance(Global.Player.transform.position, Shop.transform.position) <= 1.5f) { PlayerStatusImage.GetStatus("Interact?"); if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("BuyBread"); } } else if (Ship && Vector3.Distance(Global.Player.transform.position, MtShip1.transform.position) <= 1.5f) { PlayerStatusImage.GetStatus("Interact?"); if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("GoShip"); } } } if (GiveBread) { //Rose.SetActive(false); } }
void OnTriggerEnter(Collider other) { if (other.transform.name == "Kyder") { other.transform.GetChild(0).GetComponent <Renderer> ().enabled = false; other.gameObject.GetComponent <Collider> ().enabled = false; Flowchart.BroadcastFungusMessage("GetKyder"); PlayerStatusImage.GetStatus("None"); } }
void OnCollisionEnter(UnityEngine.Collision other) { if (other.transform.name == "Lucas") { Flowchart.BroadcastFungusMessage("LucasTalk01"); PlayerStatusImage.GetStatus("None"); } if (other.transform.name == "Soyna") { Flowchart.BroadcastFungusMessage("SoynaTalk01"); PlayerStatusImage.GetStatus("None"); } if (other.transform.name == "Riven") { Flowchart.BroadcastFungusMessage("RivenTalk01"); PlayerStatusImage.GetStatus("None"); } if (other.transform.name == "Engine") { Flowchart.BroadcastFungusMessage("GetEngine"); PlayerStatusImage.GetStatus("None"); other.transform.GetChild(0).GetComponent <Renderer> ().enabled = false; other.gameObject.GetComponent <Collider> ().enabled = false; } if (other.transform.name == "Redleaf_A" || other.transform.name == "Redleaf_B" || other.transform.name == "Redleaf_C") { other.transform.GetChild(0).GetComponent <Renderer> ().enabled = false; other.gameObject.GetComponent <Collider> ().enabled = false; Destroy(other.gameObject); PlayerStatusImage.GetStatus("None"); //print(RedLeaf); RedLeaf++; } if (other.transform.name == "Sisco") { Flowchart.BroadcastFungusMessage("SiscoTalk01"); PlayerStatusImage.GetStatus("None"); } if ((other.transform.name == "SpaceShip_Door1" || other.transform.name == "SpaceShip_Door2" || other.transform.name == "SpaceShip_Door3") || other.transform.name == "SpaceShip_Door4") { Flowchart.BroadcastFungusMessage("GO"); PlayerStatusImage.GetStatus("None"); } if (other.transform.name == "Mike") { Flowchart.BroadcastFungusMessage("MikeTalk01"); PlayerStatusImage.GetStatus("None"); } if (other.transform.name == "Bill") { Flowchart.BroadcastFungusMessage("BillTalk01"); PlayerStatusImage.GetStatus("None"); } }
public void setPlayerStatus(string _name) { switch (_name) { case "King": case "Bookroom5": case "HouseKeeper": case "Warehouse2": case "Maid": case "Servent": case "Cat": case "Cat2": case "OldMan": PlayerStatusImage.GetStatus("None"); break; } }
void OnCollisionEnter(UnityEngine.Collision other) { if (GetBread && other.transform.name == "Rose") { Rose = GameObject.Find("Rose"); Flowchart.BroadcastFungusMessage("GiveBread"); PlayerStatusImage.GetStatus("None"); } if (other.transform.name == "PrinceHome_Door") { Flowchart.BroadcastFungusMessage("RoseGoHome"); Flowchart.BroadcastFungusMessage("SecGoHome"); PlayerStatusImage.GetStatus("None"); } if (other.transform.name == "GlassRepair") { Flowchart.BroadcastFungusMessage("FindGP"); PlayerStatusImage.GetStatus("None"); } if (!Ship && (other.transform.name == "Mt.SpaceShip_Door1" || other.transform.name == "Mt.SpaceShip_Door2" || other.transform.name == "Mt.SpaceShip_Door3")) { Flowchart.BroadcastFungusMessage("GoShip"); PlayerStatusImage.GetStatus("None"); } if (other.transform.name == "Marley") { Flowchart.BroadcastFungusMessage("MarletTalk"); PlayerStatusImage.GetStatus("None"); } if (other.transform.name == "AnotherHouse_Door1" || other.transform.name == "AnotherHouse_Door2" || other.transform.name == "AnotherHouse_Door3") { Flowchart.BroadcastFungusMessage("HouseTalk"); PlayerStatusImage.GetStatus("None"); } if (other.transform.name == "WareHouse_Door") { Flowchart.BroadcastFungusMessage("WareHouseTalk"); PlayerStatusImage.GetStatus("None"); } }
void FixedUpdate() { if (MissionTargets.Find((x) => x.gameObject == null) == null && MissionTargets.IndexOf(MissionTargets.Find((x) => x.gameObject == null)) != -1) { MissionArrows.RemoveAt(MissionTargets.IndexOf(MissionTargets.Find((x) => x.gameObject == null))); MissionTargets.RemoveAt(MissionTargets.IndexOf(MissionTargets.Find((x) => x.gameObject == null))); } if (Global.LevelEnd == null) { Global.LevelEnd = GameObject.Find("Bool_LevelEnd"); } if (FlowerChart != null) { if (Global.Level == "1") { if (Vector3.Distance(Global.Player.transform.position, Rose.transform.position) <= 1.2f && FlowerChart.GetBooleanVariable("GetBread")) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("GiveBread"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else if (Vector3.Distance(Global.Player.transform.position, Shop_Door2.transform.position) <= 1.2f && FlowerChart.GetBooleanVariable("Bread")) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("BuyBread"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else if (Vector3.Distance(Global.Player.transform.position, GlassRepair.transform.position) <= 1.2f && FlowerChart.GetBooleanVariable("FindGP")) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("FindGP"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else if (Vector3.Distance(Global.Player.transform.position, PrinceHome_Door.transform.position) <= 1.2f && FlowerChart.GetBooleanVariable("GiveBread")) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("RoseGoHome"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else if (Vector3.Distance(Global.Player.transform.position, PrinceHome_Door.transform.position) <= 1.2f && FlowerChart.GetBooleanVariable("SecGoHome")) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("SecGoHome"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else if (Vector3.Distance(Global.Player.transform.position, MtShip1.transform.position) <= 1.2f && FlowerChart.GetBooleanVariable("Ship")) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("GoShip"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else if (Vector3.Distance(Global.Player.transform.position, Marley.transform.position) <= 1.2f) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("MarletTalk"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else if (Vector3.Distance(Global.Player.transform.position, AnotherHouse_Door2.transform.position) <= 1.2f) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("HouseTalk"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else if (Vector3.Distance(Global.Player.transform.position, WareHouse_Door.transform.position) <= 1.2f) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("WareHouseTalk"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else { PlayerStatusImage.GetStatus("None"); } } if (Global.Level == "2") { // Landing if (MissionSetting.FlowerChart.GetBooleanVariable("Landing") && PlayerBody != null) { SpaceShip.transform.position = Vector3.MoveTowards(SpaceShip.transform.position, new Vector3(SpaceShip.transform.position.x, Global.Player.transform.position.y, SpaceShip.transform.position.z), 0.025f); if (Mathf.Abs(SpaceShip.transform.position.y - Global.Player.transform.position.y) < 0.05f) { for (int i = 0; i < PlayerBody.transform.childCount; i++) { PlayerBody.transform.GetChild(i).gameObject.GetComponent <Renderer> ().enabled = true; PlayerBody.transform.GetChild(i).gameObject.GetComponent <FadeObject> ().PlayerFadeIn(); } if (PlayerBody.transform.GetChild(0).gameObject.GetComponent <Renderer>().material.color.a >= 0.5f && this.GetComponent <PathController>().BeTouchedFloor == null) { this.GetComponent <PathController> ().WalkOrder("V3Floor_10"); } } } if (Vector3.Distance(Global.Player.transform.position, Lucas.transform.position) <= 1.2f) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("LucasTalk01"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else if (Vector3.Distance(Global.Player.transform.position, Sisco.transform.position) <= 1.2f) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("SiscoTalk01"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else if (Vector3.Distance(Global.Player.transform.position, Riven.transform.position) <= 1.2f) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("RivenTalk01"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else if (Vector3.Distance(Global.Player.transform.position, Soyna.transform.position) <= 1.2f) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("SoynaTalk01"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else if (Vector3.Distance(Global.Player.transform.position, Mike.transform.position) <= 1.2f) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("MikeTalk01"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else if (Vector3.Distance(Global.Player.transform.position, Bill.transform.position) <= 1.2f) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("BillTalk01"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else { PlayerStatusImage.GetStatus("None"); } // Exit Planet if (FlowerChart.GetBooleanVariable("PushBox01") && FlowerChart.GetBooleanVariable("FindLeaf") && FlowerChart.GetBooleanVariable("FindEngine") && FlowerChart.GetBooleanVariable("FindKyder") && FlowerChart.GetBooleanVariable("Start")) { Flowchart.BroadcastFungusMessage("GO"); } } if (Global.Level == "3") { // Landing if (MissionSetting.FlowerChart.GetBooleanVariable("Landing") && PlayerBody != null) { SpaceShip.transform.position = Vector3.Lerp(SpaceShip.transform.position, new Vector3(SpaceShip.transform.position.x, Global.Player.transform.position.y, SpaceShip.transform.position.z), 0.1f); if (Mathf.Abs(SpaceShip.transform.position.y - Global.Player.transform.position.y) < 0.05f) { for (int i = 0; i < PlayerBody.transform.childCount; i++) { PlayerBody.transform.GetChild(i).gameObject.GetComponent <Renderer> ().enabled = true; PlayerBody.transform.GetChild(i).gameObject.GetComponent <FadeObject> ().PlayerFadeIn(); } if (PlayerBody.transform.GetChild(0).gameObject.GetComponent <Renderer>().material.color.a >= 0.5f && this.GetComponent <PathController>().BeTouchedFloor == null) { this.GetComponent <PathController> ().WalkOrder("V3Floor_2"); } } } if (Vector3.Distance(Global.Player.transform.position, King.transform.position) <= 1.2f) { // 室內場景不適用 /*if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { * PlayerStatusImage.GetStatus ("Interact?"); * } * if (Input.GetKeyDown (KeyCode.E)) { * Flowchart.BroadcastFungusMessage ("FirstTouchKing"); * PlayerStatusImage.GetStatus ("None"); * EisPressed = true; * }*/ } else if (Vector3.Distance(Global.Player.transform.position, HouseKeeper.transform.position) <= 1.2f) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("HouseKeeper"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else if (Vector3.Distance(Global.Player.transform.position, Warehouse2.transform.position) <= 1.2f) { if (!EisPressed && !FlowerChart.HasExecutingBlocks()) { PlayerStatusImage.GetStatus("Interact?"); } if (Input.GetKeyDown(KeyCode.E)) { Flowchart.BroadcastFungusMessage("Warehouse2"); PlayerStatusImage.GetStatus("None"); EisPressed = true; } } else { PlayerStatusImage.GetStatus("None"); } } switch (Blocking) { case "開頭": MissionTargets.Add(GameObject.Find("Event_Shop(Clone)")); CameraMove(GameObject.Find("Event_Shop(Clone)"), CameraController.CurrentCam, CameraController.CamTarget, new Vector3(-0.5f, 5, -0.5f), true); Blocking = null; break; case "買麵包": if (FlowerChart.GetBooleanVariable("Bread")) { Destroy(MissionArrows [MissionTargets.LastIndexOf(GameObject.Find("Event_Shop(Clone)"))]); MissionTargets.Clear(); MissionArrows.Clear(); MissionTargets.Add(GameObject.Find("Event_Rose(Clone)")); CameraMove(GameObject.Find("Event_Rose(Clone)"), CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 4, 0), true); Blocking = null; } break; case "給麵包": if (FlowerChart.GetBooleanVariable("GetBread")) { Destroy(MissionArrows [MissionTargets.LastIndexOf(GameObject.Find("Event_Rose(Clone)"))]); MissionTargets.Clear(); MissionArrows.Clear(); MissionTargets.Add(GameObject.Find("Event_PrinceHome(Clone)")); CameraMove(GameObject.Find("Event_PrinceHome(Clone)"), CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), true); Blocking = null; } break; case "帶玫瑰回家": if (FlowerChart.GetBooleanVariable("GiveBread")) { Destroy(MissionArrows [MissionTargets.LastIndexOf(GameObject.Find("Event_PrinceHome(Clone)"))]); MissionTargets.Clear(); MissionArrows.Clear(); MissionTargets.Add(GameObject.Find("Event_GlassRepair(Clone)")); CameraMove(GameObject.Find("Event_GlassRepair(Clone)"), CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 1), true); Blocking = null; } break; case "找爺爺": if (FlowerChart.GetBooleanVariable("FindGP")) { Destroy(MissionArrows [MissionTargets.LastIndexOf(GameObject.Find("Event_GlassRepair(Clone)"))]); MissionTargets.Clear(); MissionArrows.Clear(); MissionTargets.Add(GameObject.Find("Event_PrinceHome(Clone)")); CameraMove(GameObject.Find("Event_PrinceHome(Clone)"), CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), true); Blocking = null; } break; case "第二次回家": if (FlowerChart.GetBooleanVariable("SecGoHome")) { Destroy(MissionArrows [MissionTargets.LastIndexOf(GameObject.Find("Event_PrinceHome(Clone)"))]); MissionTargets.Clear(); MissionArrows.Clear(); MissionTargets.Add(GameObject.Find("Event_Mt.SpaceShip(Clone)")); CameraMove(GameObject.Find("Event_Mt.SpaceShip(Clone)"), CameraController.CurrentCam, CameraController.CamTarget, new Vector3(-0.5f, 5, -1), true); Blocking = null; } break; case "開飛船": if (FlowerChart.GetBooleanVariable("Ship")) { Destroy(MissionArrows [MissionTargets.LastIndexOf(GameObject.Find("Event_Mt.SpaceShip(Clone)"))]); MissionTargets.Clear(); MissionArrows.Clear(); Blocking = null; } break; case "開頭對話": if (Global.Level == "2") { MissionTargets.Add(GameObject.Find("Event_Lucas(Clone)")); MissionTargets.Add(GameObject.Find("Event_Soyna(Clone)")); MissionTargets.Add(GameObject.Find("Event_Riven(Clone)")); MissionTargets.Add(GameObject.Find("Event_Sisco(Clone)")); CameraMove(MissionTargets [0], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), true); MultiPos = new Vector3(0, 5, 0); Blocking = null; } break; case "盧卡斯第一次對話": //Destroy (MissionArrows [MissionTargets.LastIndexOf (GameObject.Find ("Event_Lucas(Clone)"))]); //Destroy (MissionArrows.Find((x) => x.name == "Event_Lucas(Clone)_MA")); if (MissionTargets.Contains(GameObject.Find("Event_Lucas(Clone)")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Event_Lucas(Clone)_Arrow")) { MissionArrows.FindLast((x) => x.name == "Event_Lucas(Clone)_Arrow").SetActive(false); MissionArrows.RemoveAt(MissionTargets.LastIndexOf(GameObject.Find("Event_Lucas(Clone)"))); MissionTargets.Remove(GameObject.Find("Event_Lucas(Clone)")); } /* * TargetID = MissionTargets.Count; * MissionTargets.Add (GameObject.Find ("Box_1")); * MissionTargets.Add (GameObject.Find ("Box_2")); * MissionTargets.Add (GameObject.Find ("Box_3")); * * CameraMove (MissionTargets[TargetID], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 4, 0));*/ if (FlowerChart.GetBooleanVariable("PushBox01") == false && FlowerChart.GetBooleanVariable("GetTool01") == false) { if (Arrow_Lucas) { MissionTargets.Add(GameObject.Find("Event_IncinerationPlant(Clone)")); CameraMove(MissionTargets [MissionTargets.Count - 1], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), Arrow_Lucas); } Arrow_Lucas = false; } Blocking = null; break; case "索依娜第一次對話": //Destroy (MissionArrows [MissionTargets.LastIndexOf (GameObject.Find ("Event_Soyna(Clone)"))]); //Destroy (MissionArrows.Find((x) => x.name == "Event_Soyna(Clone)_MA")); if (MissionTargets.Contains(GameObject.Find("Event_Soyna(Clone)")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Event_Soyna(Clone)_Arrow")) { MissionArrows.FindLast((x) => x.name == "Event_Soyna(Clone)_Arrow").SetActive(false); MissionArrows.RemoveAt(MissionTargets.LastIndexOf(GameObject.Find("Event_Soyna(Clone)"))); MissionTargets.Remove(GameObject.Find("Event_Soyna(Clone)")); } //MissionTargets.Add (GameObject.Find ("Event_Riven(Clone)")); //MissionTargets.Add (GameObject.Find ("Event_Station(Clone)")); //MissionTargets.Add (GameObject.Find ("Event_BattleShipWing(Clone)")); if (FlowerChart.GetBooleanVariable("FindLeaf") == false && FlowerChart.GetBooleanVariable("GetLeaf") == false) { TargetID = MissionTargets.Count; if (GameObject.Find("Redleaf_A") != null && Arrow_Soyna) { MissionTargets.Add(GameObject.Find("Redleaf_A")); } if (GameObject.Find("Redleaf_B") != null && Arrow_Soyna) { MissionTargets.Add(GameObject.Find("Redleaf_B")); } if (GameObject.Find("Redleaf_C") != null && Arrow_Soyna) { MissionTargets.Add(GameObject.Find("Redleaf_C")); } if (Arrow_Soyna) { CameraMove(MissionTargets [TargetID], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 1, 0), Arrow_Soyna); MultiPos = new Vector3(0, 1, 0); } Arrow_Soyna = false; } Blocking = null; break; case "瑞文第一次對話": //Destroy (MissionArrows [MissionTargets.LastIndexOf (GameObject.Find ("Event_Riven(Clone)"))]); //Destroy (MissionArrows.Find((x) => x.name == "Event_Riven(Clone)_MA")); if (MissionTargets.Contains(GameObject.Find("Event_Riven(Clone)")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Event_Riven(Clone)_Arrow")) { MissionArrows.FindLast((x) => x.name == "Event_Riven(Clone)_Arrow").SetActive(false); MissionArrows.RemoveAt(MissionTargets.LastIndexOf(GameObject.Find("Event_Riven(Clone)"))); MissionTargets.Remove(GameObject.Find("Event_Riven(Clone)")); } if (FlowerChart.GetBooleanVariable("FindEngine") == false && FlowerChart.GetBooleanVariable("GetEngine") == false) { if (Arrow_Riven) { MissionTargets.Add(GameObject.Find("Engine")); CameraMove(MissionTargets [MissionTargets.Count - 1], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 1, 0), Arrow_Riven); } Arrow_Riven = false; } Blocking = null; break; case "西斯寇第一次對話": //Destroy (MissionArrows [MissionTargets.LastIndexOf (GameObject.Find ("Event_Sisco(Clone)"))]); //Destroy (MissionArrows.Find((x) => x.name == "Event_Sisco(Clone)_MA")); if (MissionTargets.Contains(GameObject.Find("Event_Sisco(Clone)")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Event_Sisco(Clone)_Arrow")) { MissionArrows.FindLast((x) => x.name == "Event_Sisco(Clone)_Arrow").SetActive(false); MissionArrows.RemoveAt(MissionTargets.LastIndexOf(GameObject.Find("Event_Sisco(Clone)"))); MissionTargets.Remove(GameObject.Find("Event_Sisco(Clone)")); } if (FlowerChart.GetBooleanVariable("FindKyder") == false && FlowerChart.GetBooleanVariable("GetKyder") == false) { if (Arrow_Sisco) { MissionTargets.Add(GameObject.Find("Event_Station(Clone)")); CameraMove(MissionTargets [MissionTargets.Count - 1], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), Arrow_Sisco); } Arrow_Sisco = false; } Blocking = null; break; case "控制箱子變數": /*if(MissionArrows.Contains(GameObject.Find(GameObject.Find ("Box_1").transform.parent.gameObject.name + "_MA"))) * Destroy (MissionArrows.Find((x) => x.name == GameObject.Find ("Box_1").transform.parent.gameObject.name + "_MA")); * if(MissionArrows.Contains(GameObject.Find(GameObject.Find ("Box_2").transform.parent.gameObject.name + "_MA"))) * Destroy (MissionArrows.Find((x) => x.name == GameObject.Find ("Box_2").transform.parent.gameObject.name + "_MA")); * if(MissionArrows.Contains(GameObject.Find(GameObject.Find ("Box_3").transform.parent.gameObject.name + "_MA"))) * Destroy (MissionArrows.Find((x) => x.name == GameObject.Find ("Box_3").transform.parent.gameObject.name + "_MA"));*/ /*MissionTargets.Remove (GameObject.Find ("Box_1")); * MissionTargets.Remove (GameObject.Find ("Box_2")); * MissionTargets.Remove (GameObject.Find ("Box_3"));*/ if (MissionTargets.Contains(GameObject.Find("Event_IncinerationPlant(Clone)")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Event_IncinerationPlant(Clone)_Arrow")) { MissionTargets.Remove(GameObject.Find("Event_IncinerationPlant(Clone)")); MissionArrows.FindLast((x) => x.name == "Event_IncinerationPlant(Clone)_Arrow").SetActive(false); MissionArrows.Remove(GameObject.Find("Event_IncinerationPlant(Clone)_Arrow")); if (Arrow_Box) { MissionTargets.Add(GameObject.Find("Event_Lucas(Clone)")); } CameraMove(MissionTargets [MissionTargets.Count - 1], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), Arrow_Box); Arrow_Box = false; } Blocking = null; break; case "控制草葉變數": /*if(MissionArrows.Contains(GameObject.Find ("Event_Riven(Clone)_MA"))) * Destroy (MissionArrows.Find((x) => x.name == "Event_Riven(Clone)_MA")); * if(MissionArrows.Contains(GameObject.Find ("Event_Station(Clone)_MA"))) * Destroy (MissionArrows.Find((x) => x.name == "Event_Station(Clone)_MA")); * if(MissionArrows.Contains(GameObject.Find ("Event_BattleShipWing(Clone)_MA"))) * Destroy (MissionArrows.Find((x) => x.name == "Event_BattleShipWing(Clone)_MA"));*/ if (MissionTargets.Contains(GameObject.Find("Redleaf_A")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Redleaf_A_Arrow")) { MissionTargets.Remove(GameObject.Find("Redleaf_A")); MissionArrows.FindLast((x) => x.name == "Redleaf_A_Arrow").SetActive(false); MissionArrows.Remove(GameObject.Find("Redleaf_A_Arrow")); } if (MissionTargets.Contains(GameObject.Find("Redleaf_B")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Redleaf_B_Arrow")) { MissionTargets.Remove(GameObject.Find("Redleaf_B")); MissionArrows.FindLast((x) => x.name == "Redleaf_B_Arrow").SetActive(false); MissionArrows.Remove(GameObject.Find("Redleaf_B_Arrow")); } if (MissionTargets.Contains(GameObject.Find("Redleaf_C")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Redleaf_C_Arrow")) { MissionTargets.Remove(GameObject.Find("Redleaf_C")); MissionArrows.FindLast((x) => x.name == "Redleaf_C_Arrow").SetActive(false); MissionArrows.Remove(GameObject.Find("Redleaf_C_Arrow")); } if ((MissionTargets.Contains(GameObject.Find("Redleaf_A")) || MissionTargets.Contains(GameObject.Find("Redleaf_B")) || MissionTargets.Contains(GameObject.Find("Redleaf_C"))) && MissionArrows.FindLast((x) => x.gameObject != null && (x.name == "Redleaf_A_Arrow" || x.name == "Redleaf_B_Arrow" || x.name == "Redleaf_C_Arrow"))) { if (Arrow_RedLeaf) { MissionTargets.Add(GameObject.Find("Event_Soyna(Clone)")); } CameraMove(MissionTargets [MissionTargets.Count - 1], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), Arrow_RedLeaf); Arrow_RedLeaf = false; } Blocking = null; break; case "控制引擎變數": /*if(MissionArrows.Contains(GameObject.Find ("Event_Riven(Clone)_MA"))) * Destroy (MissionArrows.Find((x) => x.name == "Event_Riven(Clone)_MA"));*/ if (MissionTargets.Contains(GameObject.Find("Engine")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Engine_Arrow")) { MissionTargets.Remove(GameObject.Find("Engine")); MissionArrows.FindLast((x) => x.name == "Engine_Arrow").SetActive(false); MissionArrows.Remove(GameObject.Find("Engine_Arrow")); if (Arrow_Engine) { MissionTargets.Add(GameObject.Find("Event_Riven(Clone)")); } CameraMove(MissionTargets [MissionTargets.Count - 1], CameraController.CurrentCam, CameraController.CamTarget, new Vector3(0, 5, 0), Arrow_Engine); Arrow_Engine = false; } Blocking = null; break; case "控制水晶變數": if (MissionTargets.Contains(GameObject.Find("Event_Station(Clone)")) && MissionArrows.FindLast((x) => x.gameObject != null && x.name == "Event_Station(Clone)_Arrow")) { MissionTargets.Remove(GameObject.Find("Event_Station(Clone)")); MissionArrows.FindLast((x) => x.name == "Event_Station(Clone)_Arrow").SetActive(false); MissionArrows.Remove(GameObject.Find("Event_Station(Clone)_Arrow")); if (Arrow_Kyder) { MissionTargets.Add(GameObject.Find("Event_Sisco(Clone)")); } //CameraMove (MissionTargets [MissionTargets.Count - 1], CameraController.CurrentCam, CameraController.CamTarget, new Vector3 (0, 5, 0), Arrow_Kyder); Arrow_Kyder = false; } Blocking = null; break; } // Camera Move if (CurrentCam != null && ScreenHeart != null && Target != null && !FlowerChart.HasExecutingBlocks() && CamIsMoving && !FlowerChart.GetBooleanVariable("LookAround")) { if (Vector3.Distance(CurrentCam.transform.position, NextCamPos) <= 0.5f) { MissionArrows [MissionArrows.Count - 1].SetActive(true); CamRotTarget = Quaternion.LookRotation(ScreenHeart.transform.position - CurrentCam.transform.position, Vector3.Lerp(CurrentCam.transform.up, Target.transform.up, 0.1f)); CurrentCam.transform.rotation = Quaternion.Slerp(CurrentCam.transform.rotation, CamRotTarget, 0.2f); ScreenHeart.transform.position = Vector3.Lerp(ScreenHeart.transform.position, NextHeartPos, 0.03f); CurrentCam.transform.position = Vector3.Lerp(CurrentCam.transform.position, NextCamPos, 0.03f); if (Input.GetMouseButtonDown(0) || Vector3.Distance(CurrentCam.transform.position, NextCamPos) <= 0.3f) { if (MissionTargets.LastIndexOf(Target) != MissionTargets.Count - 1) { TargetID++; CameraMove(MissionTargets[TargetID], CameraController.CurrentCam, CameraController.CamTarget, MultiPos, true); } else if (MissionTargets.LastIndexOf(Target) == MissionTargets.Count - 1) { TargetID++; CamIsMoving = false; CamIsMovingBack = true; Global.StopTouch = true; } } } else { // Camera is moving. PlayerStatusImage.GetStatus("None"); ScreenHeart.transform.position = Vector3.Lerp(ScreenHeart.transform.position, NextHeartPos, 0.03f); CurrentCam.transform.position = Vector3.Lerp(CurrentCam.transform.position, NextCamPos, 0.03f); CamRotTarget = Quaternion.LookRotation(ScreenHeart.transform.position - CurrentCam.transform.position, Vector3.Lerp(CurrentCam.transform.up, Target.transform.up, 0.1f)); CurrentCam.transform.rotation = Quaternion.Slerp(CurrentCam.transform.rotation, CamRotTarget, 0.6f); } } else if (CurrentCam != null && ScreenHeart != null && Target != null && !CamIsMoving && CamIsMovingBack) { if (Vector3.Distance(CurrentCam.transform.position, CurrentCam_Origin) <= 0.1f) { TargetID = 0; ScreenHeart.transform.position = ScreenHeart_Origin; ScreenHeart.transform.rotation = ScreenHeart_OriginRot; CurrentCam = ScreenHeart = Target = null; Global.StopTouch = false; CamIsMovingBack = false; } else { // Camera is moving back. ScreenHeart.transform.position = Vector3.Lerp(ScreenHeart.transform.position, ScreenHeart_Origin, 0.04f); CurrentCam.transform.position = Vector3.Lerp(CurrentCam.transform.position, CurrentCam_Origin, 0.04f); CamRotTarget = Quaternion.LookRotation(ScreenHeart.transform.position - CurrentCam.transform.position, Vector3.Lerp(CurrentCam.transform.up, Vector3.up, 0.075f)); CurrentCam.transform.rotation = Quaternion.Slerp(CurrentCam.transform.rotation, CamRotTarget, 0.8f); } } // Get Block's Name if (FlowerChart.HasExecutingBlocks() && !AnotherOneshot) { AllBlocks = FlowerChart.GetExecutingBlocks(); Blocking = AllBlocks [AllBlocks.Count - 1].BlockName; AnotherOneshot = true; } else if (!FlowerChart.HasExecutingBlocks() && AnotherOneshot) { Blocking = null; AnotherOneshot = false; } // 第一章結尾 if (Global.Level == "1") { if (FlowerChart.HasExecutingBlocks() && Blocking == "開飛船") { if (Level01PlayerEvent.Ship && !Oneshot) { Oneshot = true; } } else if (!Level01PlayerEvent.Ship && Oneshot) { GameObject.Find("SpaceShip_Anim").GetComponent <Animation> ().Play("Fly"); CameraFade.FadeOut(); Global.Player.SetActive(false); Global.NextScene = 3; // To Chapter 02 Oneshot = false; } } if (Global.Level == "2") { if (FlowerChart.HasExecutingBlocks() && FlowerChart.SelectedBlock != null && Blocking == "閃人") { if (!Oneshot && FlowerChart.GetBooleanVariable("PushBox01") && FlowerChart.GetBooleanVariable("FindLeaf") && FlowerChart.GetBooleanVariable("FindEngine") && FlowerChart.GetBooleanVariable("FindKyder")) { Oneshot = true; } } else if (Oneshot) { GameObject.Find("SpaceShip_Anim").GetComponent <Animation> ().Play("Fly2"); CameraFade.FadeOut(); Global.Player.SetActive(false); Global.NextScene = 4; // To Chapter 03 Oneshot = false; } } } // 對話時停止移動、轉動 if (FlowerChart != null) { if (FlowerChart.HasExecutingBlocks() && BlockOn == false) { BlockOn = true; Global.StopTouch = true; PlayerStatusImage.GetStatus("IsTalking"); CameraController.OriginView = Camera.main.fieldOfView; //CameraController.CamView = 10; } else if (!FlowerChart.HasExecutingBlocks() && BlockOn == true && !CamIsMoving) { BlockOn = false; if (!CamIsMovingBack) { Global.StopTouch = false; } EisPressed = false; PlayerStatusImage.GetStatus("None"); CameraController.CamView = CameraController.OriginView; } } }
void Update() { if (MissionSetting.FlowerChart != null) { // Light if (Spotlight != null) { switch (MissionSetting.FlowerChart.GetIntegerVariable("ItemLight")) { case 0: Spotlight.GetComponent <Image> ().enabled = false; Spotlight.transform.position = Vector3.Lerp(Spotlight.transform.position, MidScreen, 10 * Time.deltaTime); break; case 1: Spotlight.GetComponent <Image> ().enabled = true; Spotlight.transform.position = Vector3.Lerp(Spotlight.transform.position, Item_1.transform.position, 5 * Time.deltaTime); if (Item_1.transform.rotation != Quaternion.Euler(0, 0, 0)) { Item_1.transform.rotation *= Quaternion.Euler(0, -100 * Time.deltaTime, 0); } Item_1.GetComponent <Image> ().color = new Color(255, 255, 255, 1); Item_2.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f); Item_3.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f); break; case 2: Spotlight.GetComponent <Image> ().enabled = true; Spotlight.transform.position = Vector3.Lerp(Spotlight.transform.position, Item_2.transform.position, 5 * Time.deltaTime); Item_1.transform.rotation = Quaternion.Euler(0, 0, 0); if (Item_2.transform.rotation != Quaternion.Euler(0, 0, 0)) { Item_2.transform.rotation *= Quaternion.Euler(0, -100 * Time.deltaTime, 0); } Item_1.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f); Item_2.GetComponent <Image> ().color = new Color(255, 255, 255, 1); Item_3.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f); break; case 3: Spotlight.GetComponent <Image> ().enabled = true; Spotlight.transform.position = Vector3.Lerp(Spotlight.transform.position, Item_3.transform.position, 5 * Time.deltaTime); Item_2.transform.rotation = Quaternion.Euler(0, 0, 0); if (Item_3.transform.rotation != Quaternion.Euler(0, 0, 0)) { Item_3.transform.rotation *= Quaternion.Euler(0, -100 * Time.deltaTime, 0); } Item_1.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f); Item_2.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f); Item_3.GetComponent <Image> ().color = new Color(255, 255, 255, 1); break; case 4: Spotlight.GetComponent <Image> ().enabled = true; Item_3.transform.rotation = Quaternion.Euler(0, 0, 0); Item_1.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f); Item_2.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f); Item_3.GetComponent <Image> ().color = new Color(255, 255, 255, 0.3f); break; } } if (Global.Level == "1") { if (MissionSetting.FlowerChart.FindBlock("買麵包") != null && MissionSetting.FlowerChart.FindBlock("買麵包").IsExecuting() && Bread != null && Bread.activeSelf) { Bread.GetComponent <Renderer> ().enabled = true; PlayerStatusImage.GetStatus("None"); Bread.transform.position = Vector3.MoveTowards(Bread.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0), 0.02f); if (Vector3.Distance(Bread.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0)) < 0.01f) { Bread.SetActive(false); } } if (MissionSetting.FlowerChart.GetBooleanVariable("TakeKey")) { Key.transform.GetChild(0).GetComponent <Renderer> ().enabled = true; Key.transform.GetChild(1).GetComponent <Renderer> ().enabled = true; PlayerStatusImage.GetStatus("None"); Key.transform.position = Vector3.MoveTowards(Key.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0), 0.02f); if (Vector3.Distance(Key.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0)) < 0.01f) { Key.transform.GetChild(0).GetComponent <Renderer> ().enabled = false; Key.transform.GetChild(1).GetComponent <Renderer> ().enabled = false; } } } if (Global.Level == "2") { if (MissionSetting.FlowerChart.GetBooleanVariable("TakeBooster")) { Booster.GetComponent <Renderer> ().enabled = true; PlayerStatusImage.GetStatus("None"); Booster.transform.position = Vector3.MoveTowards(Booster.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0), 0.02f); if (Vector3.Distance(Booster.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0)) < 0.01f) { Booster.GetComponent <Renderer> ().enabled = false; Item_1.GetComponent <Image> ().color = new Color(255, 255, 255, 1); } } if (MissionSetting.FlowerChart.GetBooleanVariable("TakeFire")) { //FireBottle.GetComponent<Renderer> ().enabled = true; showRenderer(FireBottle, true); PlayerStatusImage.GetStatus("None"); FireBottle.transform.position = Vector3.MoveTowards(FireBottle.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0), 0.02f); if (Vector3.Distance(FireBottle.transform.position, Global.Player.transform.position + new Vector3(0, 1, 0)) < 0.01f) { showRenderer(FireBottle, false); Item_2.GetComponent <Image> ().color = new Color(255, 255, 255, 1); } } if (MissionSetting.FlowerChart.GetBooleanVariable("TakeOil")) { PlayerStatusImage.GetStatus("None"); Item_3.GetComponent <Image> ().color = new Color(255, 255, 255, 1); } } if (Global.Level == "3") { } } }