Beispiel #1
0
    void SpawnZombie(int id)
    {
        float randomX = Random.Range(-20, 20); //적이 나타날 X좌표를 랜덤으로 생성해 줍니다.
        float randomY = Random.Range(-20, 20); //이건 y좌표 !

        var zombie    = ZombieMemoryPool.GetObject(id);
        var direction = new Vector2(randomX, randomY);

        zombie.transform.position = direction;
    }
Beispiel #2
0
    private void Awake()                           //오브젝트 풀 초기화
    {
        Instance = this;                           //오브젝트풀 인스턴스에 자기 할당화 (싱글톤)
        for (int i = 0; i < zombieList.Count; i++) //
        {
            poolingObjectQueue.Add(new Queue <Zombie>());

            Initialize(50, i);
        }
    }
    IEnumerator IZombieDead()
    {
        yield return(new WaitForSeconds(0.1f));

        ZombieMemoryPool.ReturnObject(this, 0);
    }
Beispiel #4
0
 public void DestroyZombie()               //좀비 1 : 0, 좀비2 : 1;
 {
     ZombieMemoryPool.ReturnObject(this, 0);
 }