コード例 #1
0
 void Start()
 {
     firstPoint = GameObject.FindObjectOfType <Path_Creation>().path[0].transform.position;
     pool       = Object_Pool.Instance;
     SetUpWave();
     StartCoroutine(SpawnWave());
 }
コード例 #2
0
 // Start is called before the first frame update
 void Start()
 {
     movement = GetComponent <Tower_Movement>();
     Invoke("Rotate", Time.deltaTime);
     Invoke("StartShooting", Time.deltaTime);
     pool = Object_Pool.Instance;
 }
コード例 #3
0
 void Start()
 {
     waveManager = GameObject.FindObjectOfType <Wave_Manager>();
     shooting    = false;
     StartCoroutine(Shoot());
     pool = Object_Pool.Instance;
 }
コード例 #4
0
    void Awake()
    {
        //Assigns instance
        Instance = this;

        //initiallises the object pools as a string and queue
        //the string is the object type
        //the queue is the data structure to hold the objects. Queues are fast to grab the first item out of them which makes them ideal for spawning things out of them
        poolDictionary = new Dictionary <string, Queue <GameObject> >();

        //sets up the pools and instanciates the disables objects in the scene
        foreach (Pool pool in pools)
        {
            Queue <GameObject> objectPool = new Queue <GameObject>();

            for (int i = 0; i < pool.size; i++)
            {
                GameObject obj = Instantiate(pool.prefab, Vector3.zero, Quaternion.identity, transform);
                obj.SetActive(false);
                objectPool.Enqueue(obj);
            }
            //adds the pool to the dictionary
            poolDictionary.Add(pool.tag, objectPool);
        }
    }
コード例 #5
0
    // Use this for initialization
    void Start()
    {
        object_pooler = Object_Pool.instance;

        if (find_objects)
        {
            region_clone    = transform.parent.Find("Region_Clone").gameObject;
            region_parent   = transform.parent.Find("Region_Parent").gameObject;
            rigidbody_clone = transform.parent.Find("Rigidbody_Clone").gameObject.GetComponent <Rigidbody>();
        }
    }
コード例 #6
0
 void Awake()
 {
     instance = this;
 }