コード例 #1
0
 void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
     }
     this.StopAllCoroutines();
     showTween.Kill(true);
     OnComplete -= GoToMinigame;
 }
コード例 #2
0
 void Awake()
 {
     instance      = this;
     trailsManager = this.GetComponent <GamesSelectorTrailsManager>();
     tutorial      = this.GetComponentInChildren <GamesSelectorTutorial>(true);
 }
コード例 #3
0
        void Update()
        {
            if (Time.timeScale <= 0)
            {
                // Prevent actions when pause menu is open
                if (isDragging)
                {
                    StopDrag();
                }
                return;
            }

#if UNITY_EDITOR
            if (Input.GetKeyDown(KeyCode.R))
            {
                Destroy(this.gameObject);
                instance = null;
                Show(new List <MiniGameData>()
                {
                    new MiniGameData()
                    {
                        Main = MiniGameCode.Maze.ToString(), Variation = "letters"
                    },
                    new MiniGameData()
                    {
                        Main = MiniGameCode.DancingDots.ToString(), Variation = "words"
                    },
                    new MiniGameData()
                    {
                        Main = MiniGameCode.MakeFriends.ToString(), Variation = "spelling"
                    },
                    new MiniGameData()
                    {
                        Main = MiniGameCode.Egg.ToString(), Variation = "sunmoon"
                    },
                    new MiniGameData()
                    {
                        Main = MiniGameCode.DancingDots.ToString(), Variation = "counting"
                    }
                });
                return;
            }
#endif

            if (!Input.GetMouseButton(0) && !Input.GetMouseButtonUp(0))
            {
                return;
            }

            Vector3 mouseP = cam.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, cam.nearClipPlane + 10));
            if (Input.GetMouseButtonDown(0))
            {
                // Start drag/click
                isDragging = true;
                currTrail  = trailsManager.Spawn(mouseP);
            }
            if (isDragging)
            {
                Update_Dragging(mouseP);
            }
            if (Input.GetMouseButtonUp(0))
            {
                // Stop drag/click
                StopDrag();
            }
        }