예제 #1
0
    public void RemoveFish(int amount)
    {
        SchoolChild_BCK dObj = _roamers[_roamers.Count - 1];

        _roamers.RemoveAt(_roamers.Count - 1);
        Destroy(dObj.gameObject);
    }
예제 #2
0
    public void AddFish(int amount)
    {
        _childAmount = amount;
        if (_groupChildToNewTransform)
        {
            InstantiateGroup();
        }
        for (int i = 0; i < amount; i++)
        {
            int             child = Random.Range(0, _childPrefab.Length);
            SchoolChild_BCK obj   = (SchoolChild_BCK)Instantiate(_childPrefab[child]);

            if (_isObjective)
            {
                obj.gameObject.AddComponent <ObjectDetection>();
            }

            obj._spawner        = this;
            obj.gameObject.name = _childPrefab[child].name;
            _roamers.Add(obj);
            AddChildToParent(obj.transform);
        }
    }