private void OnDestroy() { if (_instance == this) { Destroy(_mouseSwipe); _instance = this; _controlsDoubleTap = null; _mouseSwipe = null; } }
// public void void CheckUserInput() { bool space = Input.GetKeyDown(KeyCode.Space); if (space) { pause = !pause; } if (pause == false) { MouseSwipe swipe = swipeDetector.GetComponent <MouseSwipe>(); bool down = SwipeManager.IsSwipingDownLeft(); bool up = SwipeManager.IsSwipingUpRight(); bool left = SwipeManager.IsSwipingUpLeft(); bool right = SwipeManager.IsSwipingDownRight(); if (down || up || left || right) { PrepareTilesForMerging(); if (up) { IsoCarte(); MoveAllTile(Vector2.up); CarteIso(); } if (down) { IsoCarte(); MoveAllTile(Vector2.down); CarteIso(); } if (left) { IsoCarte(); MoveAllTile(Vector2.left); CarteIso(); } if (right) { IsoCarte(); MoveAllTile(Vector2.right); CarteIso(); } } } }
private void Awake() { if (_instance == null) { _instance = this; _instance.hideFlags = HideFlags.HideInInspector | HideFlags.HideInHierarchy; if (_mouseSwipe == null) { _mouseSwipe = new GameObject().AddComponent <MouseSwipe>(); } if (_controlsDoubleTap == null) { _controlsDoubleTap = new Hashtable(); } } else { DestroyImmediate(this); } }