Esempio n. 1
0
 private void OnDestroy()
 {
     if (instance == this)
     {
         bulletDictionary = null;
         instance         = null;
     }
 }
Esempio n. 2
0
    private string GetCurrentBulletTag(BulletArray ba, int elapsedFrames)
    {
        int tagIndex = 0;

        if (ba.bulletTypeDuration != 0)
        {
            tagIndex = (elapsedFrames / ba.bulletTypeDuration) % ba.bulletTags.Count;
        }
        return(ba.bulletTags[tagIndex]);
    }
Esempio n. 3
0
 private void OnEnable()
 {
     if (instance == null)
     {
         instance         = this;
         bulletDictionary = new Dictionary <string, GameObject>();
         DictIO();
     }
     else
     {
         Debug.LogWarning("There should only be one BulletArray Asset in the project!");
         DestroyImmediate(this);
     }
 }
Esempio n. 4
0
    // Start is called before the first frame update
    void Start()
    {
        BulletArray bulletArray = BulletArray.instance;

        bulletArray.DictIO();
        bulletDictionary = new Dictionary <string, Queue <GameObject> >();
        dummy            = new GameObject();
        foreach (Bullet bullet in bulletArray.enemies)
        {
            Queue <GameObject> bulletPool = new Queue <GameObject>();
            for (int i = 0; i < bullet.size; i++)
            {
                GameObject newBulet = Instantiate(bullet.gameObject);
                newBulet.name = bullet.name;
                newBulet.SetActive(false);
                bulletPool.Enqueue(newBulet);
            }
            bulletDictionary.Add(bullet.name, bulletPool);
        }
    }
    private void OnDisable()
    {
        BulletArray Inspecting = (BulletArray)target;

        Inspecting.DictIO();
    }