Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        //Objective Text
        if (!foodGenFinished && SceneManager.GetActiveScene().name == "Level1")
        {
            objectiveText.text = "Collect 6 food and Head to target for completion";
        }
        if (!foodGenFinished && SceneManager.GetActiveScene().name != "Level1")
        {
            objectiveText.text = "Head to target for completion";
        }

        //Timer
        timerUI = Instantiate(Resources.Load <GameObject>("Prefabs/UI/Timer"), new Vector3(0f, 0f), Quaternion.identity);
        timerUI.GetComponentInChildren <Text>().color = new Color32(255, 255, 255, 100);

        //the default value for the timer is started
        timerUI.GetComponentInChildren <timerManager>().timerStarted = true;

        foodPrefab = Resources.Load <GameObject>("Prefabs/Food");

        foodParent = new GameObject("Food");
        foodParent.transform.position = new Vector3(0f, 0f);

        snakeController         = GameObject.FindGameObjectWithTag("Player").GetComponent <snakeHeadController>();
        snakeController.enabled = false;

        if (SceneManager.GetActiveScene().name == "Level3")
        {
            movingObstacleCreator = Camera.main.GetComponent <ObstacleSpawnScript>();
        }

        StartCoroutine(foodGeneration());
    }
Пример #2
0
    // Start is called before the first frame update
    void Start()
    {
        objectToMove = this.transform;

        obsSpawner = Camera.main.GetComponent <ObstacleSpawnScript>();

        waypointParent = new GameObject("Waypoints");
        waypointParent.transform.position = new Vector3(0f, 0f);


        StartCoroutine(TaskRun());
    }