/// <summary> /// 設定指令索引值 /// </summary> /// <param name="seatIndex"></param> public void SetSeatIndex(int seatIndex) { this.seatIndex = seatIndex; //座位索引 seatIndexText.text = SeatIndexHelper.SeatIndexToKeyCode(seatIndex); gameObject.name = seatIndexText.text; }
void OnGUI() { #region All //全部角色聽口令 if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { //基本 if (Input.GetKeyDown(KeyCode.F))//重設漂浮 { spaceDirector.Floating(); } else if (Input.GetKeyDown(KeyCode.P))//全部暫停 { spaceDirector.Stop(); } else if (Input.GetKeyDown(KeyCode.R))//全部恢復 { spaceDirector.Resume(); } //特殊 else if (Input.GetKeyDown(KeyCode.T))//回歸集合 { spaceDirector.BackToSeat(); } } #endregion #region Assign //當前指定角色退回 if (Input.GetKeyDown(KeyCode.UpArrow)) { Debug.Log("Back"); spaceDirector.Back(); } //指定角色出場 if (Input.GetKey(KeyCode.DownArrow)) { foreach (char c in Input.inputString) { int index = SeatIndexHelper.SeatKeyCodeToIndex(c); if (index != -1) { spaceDirector.PopOut(index); } else { Debug.Log("超出範圍"); } } } #endregion }
public void Init(int index, Seat s) { this.index = index; seat = s; string i = SeatIndexHelper.SeatIndexToKeyCode(index); seatIndexText.text = i; transform.position = seat.seatPos; transform.rotation = Quaternion.Euler(seat.rotation); }
private void Start() { seatingPlanner = FindObjectOfType <SeatingPlanner>(); gameObject.name = SeatIndexHelper.SeatIndexToKeyCode(index); }