示例#1
0
    void Start()
    {
        //Set Spawn Parent
        spawnParent = GameObject.Find("Entities").transform;
        //Get Spawn Locations
        player = GameObject.Find("PlayerSprite");
        foreach (Transform t in GameObject.Find("SpawnLocations").transform)
        {
            print(t.gameObject.name);
            if (t.gameObject.name == "SpawnLocations")
            {
                break;
            }
            else
            {
                spawnLocations.Add(t);
            }
        }
        levelCompletePanel = GameObject.Find("LevelComplete").GetComponent <LevelCompletePanel>();
        blocked            = false;

        //UI
        nextLevelButton = GameObject.Find("Next_Level_Button").GetComponent <Button>();
        nextLevelButton.interactable = true;

        game_score = 0;

        //Read in JSON
        TextAsset levelfile = Resources.Load("levels/" + levelname) as TextAsset;

        levelinfo       = JsonUtility.FromJson <LevelInfo>(levelfile.text);
        increment_timer = 0f;
        StartCoroutine("Level");
    }
示例#2
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
示例#3
0
 private void Reset()
 {
     mainMenuPanel      = FindObjectOfType <MainMenuPanel>();
     gameOverPanel      = FindObjectOfType <GameOverPanel>();
     levelCompletePanel = FindObjectOfType <LevelCompletePanel>();
     fadePanel          = FindObjectOfType <FadePanel>();
     optionsPanel       = FindObjectOfType <OptionsPanel>();
     creditsPanel       = FindObjectOfType <CreditsPanel>();
 }
    // Use this for initialization
    void Start()
    {
        float canvasWidth         = MyCanvas.canvasWidth;
        float canvasHeight        = MyCanvas.canvasHeight;
        float currentScreenWidth  = 520f;
        float currentScreenHeight = 320f;

        print(canvasWidth + "," + canvasHeight);
        foreach (Transform obj in transform)
        {
            if (!("Boundary".Equals(obj.tag)) /*&& !( "SlidingButton" ).Equals( obj.tag ) && !("SlidingButtonBig").Equals( obj.tag )*/)
            {
                Vector3 myLocation = obj.transform.localPosition;
                float   objWidth   = obj.GetComponent <RectTransform>().rect.width;
                float   objHeight  = obj.GetComponent <RectTransform>().rect.height;
                print(obj.name + "::" + myLocation);

                if (!("SlidingButton").Equals(obj.tag) && !("SlidingButtonBig").Equals(obj.tag))
                {
                    obj.transform.localPosition = new Vector3(((myLocation.x) / currentScreenWidth) * (canvasWidth), ((myLocation.y) / canvasHeight) * (canvasHeight), 0f);
                }


                /*if( !"Glass".Equals( obj.tag ) ){
                 *
                 *      obj.GetComponent<RectTransform>().sizeDelta = new Vector2( obj.GetComponent<RectTransform>().rect.width * ( canvasWidth / currentScreenWidth ) , obj.GetComponent<RectTransform>().rect.height * ( canvasHeight / currentScreenHeight ) ) ;
                 *
                 *      if( "Player".Equals( obj.tag ) ){
                 *              obj.GetComponent<RectTransform>().sizeDelta = new Vector2( obj.GetComponent<RectTransform>().rect.width * ( canvasWidth / currentScreenWidth ) , obj.GetComponent<RectTransform>().rect.width * ( canvasWidth / currentScreenWidth ) ) ;
                 *              print( "setting radius as : " + ( ( obj.GetComponent<RectTransform>().rect.width * ( canvasWidth / currentScreenWidth )) / 2f ));
                 *              obj.GetComponent<CircleCollider2D>().radius = ( obj.GetComponent<RectTransform>().rect.width ) / 2f ;
                 *      }
                 *
                 * }
                 * else{*/
                print((canvasWidth / currentScreenWidth));
                obj.transform.localScale *= (canvasWidth / currentScreenWidth);


                //}

                print(obj.name + "::::::" + new Vector3(((myLocation.x) / currentScreenWidth) * (canvasWidth), ((myLocation.y) / currentScreenHeight) * (canvasHeight), 0f));
            }
        }
        LevelCompletePanel.resizeLevelCompletePanel();
    }
    void OnGUI()
    {
        if (HasBallEntered)
        {
            var centeredStyle = GUI.skin.GetStyle("Label");
            centeredStyle.alignment = TextAnchor.UpperCenter;
            centeredStyle.fontSize  = fontSize;

            if (timeEntered < 150)
            {
                GUI.Label(new Rect(Screen.width / 2 - 50, Screen.height / 4, 100, 50), "" + (timeEntered / 50 + 1));
            }

            if (timeEntered > 150)
            {
                /*var fishEye = new FishEyeTransition()
                 * {
                 *      nextScene = SceneManager.GetActiveScene().buildIndex ,
                 *      duration = 2.0f,
                 *      size = 0.2f,
                 *      zoom = 100.0f,
                 *      colorSeparation = 0.1f
                 * };
                 * TransitionKit.instance.transitionWithDelegate( fishEye );
                 * Object[] objects = FindObjectsOfType (typeof(GameObject));
                 * foreach (GameObject go in objects) {
                 *
                 *      if( ( !go.name.Equals("levelComplete") || !go.transform.parent.name.Equals("levelComplete") ) )
                 *      {
                 *              go.isStatic = true ;
                 *              print(go.name) ;
                 *      }
                 * }*/

                //Time.timeScale = 0.0f;



                LevelCompletePanel.MoveInPanel(3, 3);
            }
        }
    }
 private void Awake()
 {
     instance = this;
 }
 public void Start()
 {
     instance = this;
 }