protected GesturePointer GetPointer(GameObject p, bool isMultiPoints = false) { if (p == null) { return(null); } GesturePointer newPointer = new GesturePointer(); newPointer.isMultiPoints = isMultiPoints; newPointer.body = Instantiate(p); for (int i = 0; i <= longPressBorder.Count; i++) { Transform bodyTran = newPointer.body.transform.Find(Common.CO.LEVEL_PREFIX + i.ToString()); if (bodyTran == null) { newPointer.levelBodyList.Add(null); newPointer.levelLineList.Add(null); continue; } newPointer.levelBodyList.Add(bodyTran.gameObject); LineRenderer line = bodyTran.GetComponentInChildren <LineRenderer>(); newPointer.levelLineList.Add(line); } newPointer.ResetLevelLine(); newPointer.body.SetActive(false); return(newPointer); }
//長押しレベルによるポインター表示変更 protected void SetPointerLevel(GesturePointer p) { if (p == null || (!p.body.activeInHierarchy && pressLevel > 0)) { return; } GameObject activeBody = p.levelBodyList[pressLevel]; GameObject stockBody = null; for (int i = 0; i < p.levelBodyList.Count; i++) { if (p.levelBodyList[i] == null) { continue; } if (stockBody == null) { stockBody = p.levelBodyList[i]; } p.levelBodyList[i].SetActive(false); } if (activeBody == null) { activeBody = stockBody; } if (activeBody != null) { activeBody.SetActive(true); } }
protected override void Awake() { isDontDestroyOnLoad = false; base.Awake(); inputStatus = new InputStatus(); mainCam = Camera.main; if (longPressBorder.Count > 0) { //長押し時間設定 GetComponent <LongPressGesture>().TimeToPress = longPressBorder[0]; } //pointer格納 pointerObj = GetPointer(pointer); pointerStartObj = GetPointer(pointerStart, isMultiLineStartPointer); pointerLongObj = GetPointer(pointerLong, isMultiLineLongPointer); ResetState(false); }