Exemple #1
0
    // Start is called before the first frame update
    void Start()
    {
        Transition      = GameObject.Find("TransitionCanvas");
        SceneTransition = Transition.GetComponent <SceneTransitionScript>();
        SceneTransition.TransitionOut();



        if (SceneManager.GetActiveScene() == SceneManager.GetSceneByName("IntroScene"))
        {
            resolutions = Screen.resolutions;
            resolutionDropdown.ClearOptions();
            List <string> options           = new List <string>();
            int           currentresolution = 0;
            for (int i = 0; i < resolutions.Length; i++)
            {
                string option = resolutions[i].width + " x " + resolutions[i].height;
                options.Add(option);

                if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height)
                {
                    currentresolution = i;
                }
            }

            resolutionDropdown.AddOptions(options);
            resolutionDropdown.value = currentresolution;
            resolutionDropdown.RefreshShownValue();
        }
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        RaycastHit hit;
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit, 2f) && Input.GetMouseButtonDown(0))
        {
            if (hit.transform.tag == "SceneChanger")
            {
                Debug.Log("hit boui");
                SceneTransitionScript sceneTransitionScript = hit.transform.gameObject.GetComponent <SceneTransitionScript>();
                StartCoroutine(sceneTransitionScript.SceneTransitionRoutine());
            }
        }
    }
Exemple #3
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);

        animator = GetComponentInChildren <Animator>();
    }
Exemple #4
0
    void Start()
    {
        max_x = 7;
        max_y = 3;
        min_x = -8;
        min_y = -3;

        DragonAIScript_ = GameObject.Find("dragonhead").GetComponent <DragonAIScript>();

        Transition      = GameObject.Find("TransitionCanvas");
        SceneTransition = Transition.GetComponent <SceneTransitionScript>();

        max_health = DragonAIScript_.health;

        InvokeRepeating("SpawnFood", 2f, 2f);

        StartCoroutine("StartLevel");
    }