示例#1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Alpha7))
     {
         List <GameObject> a = GameObject.FindGameObjectsWithTag("Wall").ToList();
         a.AddRange(GameObject.FindGameObjectsWithTag("Buff"));
         a.AddRange(GameObject.FindGameObjectsWithTag("Obstacle"));
         a.AddRange(GameObject.FindGameObjectsWithTag("Platform"));
         a.AddRange(GameObject.FindGameObjectsWithTag("Ball"));
         foreach (GameObject r in a)
         {
             r.AddComponent <Rigidbody2D>().gravityScale = 1;
             r.AddComponent <BoxCollider2D>();
         }
     }
     if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKey("joystick button 7"))
     {
         if (Paused)
         {
             PauseGroup.SetActive(false);
             Time.timeScale = 1;
         }
         else
         {
             PauseGroup.SetActive(true);
             es.SetSelectedGameObject(PauseGroup.transform.Find("Continue").gameObject);
             Time.timeScale = 0;
         }
         Paused = !Paused;
     }
     if (GameData.S_DisplayFPS)
     {
         FPSCounter.text = (1f / Time.deltaTime).ToString();
     }
 }
        /// <summary>
        /// Sets the pause status for a group of pause components.
        /// </summary>
        /// <param name="pauseGroup">The pause group.</param>
        /// <param name="paused">True if paused, false if unpaused</param>
        public static void SetPaused(PauseGroup pauseGroup, bool paused)
        {
            if (GetPaused(pauseGroup) == paused)
            {
                return;
            }

            pauseStates[( int )pauseGroup] = paused;

            if ((notifiers[( int )pauseGroup] == null))
            {
                return;
            }

            notifiers[( int )pauseGroup](paused);
        }
 public static int Sub(this int L, PauseGroup R)
 {
     return(L.Sub(R.AsPauseMask()));
 }
 public static int Add(this PauseGroup L, PauseGroup R)
 {
     return(L.AsPauseMask().Add(R.AsPauseMask()));
 }
 public static int AsPauseMask(this PauseGroup L)
 {
     return(1 << ( int )L);
 }
 /// <summary>
 /// Get the pause status of a given group.
 /// </summary>
 /// <param name="pauseGroup">The pause group.</param>
 /// <returns>True if paused, false otherwise.</returns>
 public static bool GetPaused(PauseGroup pauseGroup)
 {
     return(pauseStates[( int )pauseGroup]);
 }
示例#7
0
 public void PauseContinueButton()
 {
     Time.timeScale = 1;
     Paused         = false;
     PauseGroup.SetActive(false);
 }