Example #1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.P))
     {
         if (Time.timeScale == 0)
         {
             ContinueLevel();
         }
         else
         {
             PauseGame();
         }
     }
     else if (Input.GetKeyDown(KeyCode.B))
     {
         CreateBoxes BoxMaker = MainController.GetComponent <CreateBoxes>();
         if (BoxMaker.bombpocalypse_on == false)
         {
             BoxMaker.bombpocalypse_on = true;
         }
         else
         {
             BoxMaker.bombpocalypse_on = false;
         }
     }
 }
Example #2
0
    //Vector3 backgroundNewPos;
    //public GameObject backgroundPosition;

    // Use this for initialization
    void Start()
    {
        BoxMaker      = MainController.GetComponent <CreateBoxes>();
        OtherControls = MainController.GetComponent <OtherGameControls>();
        //levelSize = MainController.GetComponent<OtherGameControls>().LevelSize;

        PlatformOffset_y = Platform.position.y - Camera.position.y;
        SpawnOffset_y    = BoxMaker.spawnLocation.y - Camera.position.y;

        Platform.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation | RigidbodyConstraints2D.FreezePositionY;


        // Set Block Spawning right outside camera view
        MainController.GetComponent <CreateBoxes>().spawnLocation.y = Camera.transform.position.y + 7.5f;

        SetLevel(currentLevel);
        transform.localPosition = CalcTriggerPosition();
        NonScrollablePositions();

        //timer = timeToCompleteLevel;

        // Hide scoreboard
        LevelScoreText.enabled = false;
        NumBlocksText.enabled  = false;
        StuckBonusText.enabled = false;
        ResumeButton.gameObject.SetActive(false);
    }