Esempio n. 1
0
    private void Awake()
    {
        cm             = GameObject.FindGameObjectWithTag("CheckpointManager");
        cmClass        = cm.GetComponent <CheckpointManager>();
        deathPanel     = GameObject.FindGameObjectWithTag("DeathPanel");
        deathPanel2    = GameObject.FindGameObjectWithTag("DeathPanel2");
        fallingPlat    = GameObject.FindGameObjectsWithTag("FallingPlatform");
        movingPlatform = GameObject.FindGameObjectsWithTag("MovingPlatform");
        buttonPause    = GameObject.FindGameObjectWithTag("PauseButton");
        pfClass        = new PlatformFall[fallingPlat.Length];
        pmClass        = new PlatformMove[movingPlatform.Length];

        if (deathPanel && deathPanel.activeSelf)
        {
            deathPanel.gameObject.SetActive(false);
        }

        if (deathPanel2 && deathPanel2.activeSelf)
        {
            deathPanel2.gameObject.SetActive(false);
        }


        wlc = GameObject.FindGameObjectWithTag("Ball").GetComponent <WinLoseCheck>();
        this.GetComponent <Rigidbody2D>().velocity = Vector3.zero;

        for (int i = 0; i < fallingPlat.Length; i++)
        {
            pfClass[i] = fallingPlat[i].GetComponent <PlatformFall>();
        }

        for (int i = 0; i < movingPlatform.Length; i++)
        {
            pmClass[i] = movingPlatform[i].GetComponent <PlatformMove>();
        }

        if (Time.timeScale == 0)
        {
            Time.timeScale = 1;
        }
    }
    List <int> enemyBlockPos = new List <int>();   //for exit



    // Use this for initialization

    void Awake()
    {
        map     = Instantiate(map_prefab);
        UI      = Instantiate(UI_prefab);
        Turn    = Instantiate(Turn_prefab);
        WLcheck = Instantiate(WLcheck_prefab);

        _rdsGeneEnemy = rdsGeneEnemy;


        //LevelManager = Instantiate(LevelManager_prefab);
        //Dialogue = Instantiate(Dialogue_prefab);
        //Dialogue.transform.SetParent(UI.transform);
        //Dialogue.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, 0);
        //Debug.Log(UI.GetComponent<RectTransform>().rect);
        //Dialogue.transform.GetChild(0).gameObject.GetComponent<RectTransform>().rect.Set(0,0,UI.GetComponent<Rect>().width,
        //UI.GetComponent<Rect>().height);
        //for (int i = 0; i < Dialogue.transform.childCount;++i)
        //Dialogue.transform.GetChild(0).GetComponent<RectTransform>().sizeDelta = new Vector2(UI.GetComponent<RectTransform>().rect.width,UI.GetComponent<RectTransform>().rect.height);
        //Dialogue.transform.localScale = new Vector3(1, 1, 1);

        map_ctr     = map.GetComponent <Map_Control>();
        UI_ctr      = UI.GetComponent <InGameUI>();
        Turn_ctr    = Turn.GetComponent <Turn_Control>();
        WLcheck_ctr = WLcheck.GetComponent <WinLoseCheck>();
        //level_ctr = LevelManager.GetComponent<LevelManager>();
        //dialogue_ctr = Dialogue.GetComponent<DialogueManager>();

        //director = timeline.GetComponent<PlayableDirector>();
        //PlayableAsset playable = director.playableAsset;
        //TimelineAsset timelineAsset = (TimelineAsset)playable;
        //TrackAsset UItrack = timelineAsset.GetOutputTrack(6);
        //director.SetGenericBinding(UItrack, UI);
        //director.Play();

        LevelStart();



        UI.SetActive(false);
    }