示例#1
0
 // Use this for initialization
 void Start()
 {
     one        = 1;
     controller = GetComponent <VacuumShaders.CurvedWorld.CurvedWorld_Controller>();
 }
    // Use this for initialization
    void Start()
    {
        timer = 0;
        spawn = 0;
        groundWith = 5;
        curvedController = CurvedWorldScript.GetComponent<VacuumShaders.CurvedWorld.CurvedWorld_Controller>();
        SpawnWall = true;

        float bendX = Random.Range(-5, 3);
        float bendY = Random.Range(-5, 6);
        newPosition = new Vector2(bendX, bendY);

        // Keeps track of how many world objects there should be spawned of the same type
        levelCounter = new Vector2(0, 0);

        // Object pooling
        //obstacles = new List<GameObject>();
        coins = new List<GameObject>();
        obstacleComponents = new List<GameObject>[obstaclePrefabs.Count];
        worldCompontents = new List<GameObject>[prefabs.Count];

        // Pool all the coins
        for (int i = 0; i < 20; i++)
        {
            GameObject obj = (GameObject)Instantiate(CoinObject);
            obj.SetActive(false);
            coins.Add(obj);
        }

        // Pool all the obstacles
        for (int i = 0; i < obstaclePrefabs.Count; i++)
        {
            obstacleComponents[i] = new List<GameObject>();
            for (int q = 0; q < 15; q++)
            {
                GameObject obj = (GameObject)Instantiate(obstaclePrefabs[i]);
                obj.SetActive(false);
                obstacleComponents[i].Add(obj);
            }
        }

        // Bool all the level components
        for (int i = 0; i < prefabs.Count; i++)
        {
            worldCompontents[i] = new List<GameObject>();
            for (int q = 0; q < 10; q++)
            {
                GameObject obj = (GameObject)Instantiate(prefabs[i]);
                obj.SetActive(false);
                worldCompontents[i].Add(obj);
            }

        }
    }
 // Use this for initialization
 void Start()
 {
     iM = GetComponent<InputManager>();
     rb = GetComponent<Rigidbody>();
     timer = 0;
     Duck = false;
     grounded = false;
     scale = transform.localScale;
     curvedController = CurvedWorldScript.GetComponent<VacuumShaders.CurvedWorld.CurvedWorld_Controller>();
 }