private void OnGUI() { if (GUI.Button(new Rect(0.4f * Screen.width, 70, 150, 35), "开船")) { if (click == true && this._controller.Ship.passengers.Count != 0) { ship_action s = ScriptableObject.CreateInstance <ship_action>(); this.current_ship_action = s; this.click = false; } } if (GUI.Button(new Rect(0.4f * Screen.width, 30, 150, 35), "重新开始")) { Application.LoadLevel(0); } GUIStyle bb = new GUIStyle(); //创建GUI的格式 bb.normal.background = null; bb.normal.textColor = new Color(255, 255, 255); bb.fontSize = 25; GUI.Label(new Rect(0.43f * Screen.width, 110, 150, 35), show, bb); if (show == "You Fail!" || show == "You Win!") { click = false; } }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0) && click == true) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { Person temp = find_person(hit.collider.gameObject); if (temp != null) { person_action charu = ScriptableObject.CreateInstance <person_action>(); charu.set_Person(temp); current_person_action = charu; click = false; } } } if (click == false) { if (current_ship_action != null) { if (current_ship_action.update()) { this.current_ship_action = null; this.click = true; } } else if (current_person_action != null) { if (current_person_action.update()) { this.current_person_action = null; this.click = true; } } } show = _controller.judge(); }