Пример #1
0
    void SpawnEntity()
    {
        _timer -= Time.deltaTime;

        if (_timer < 0 && _entityCountAmount <= _totalamount)
        {
            _timer = _spawnrateseconds;
            int rand = Random.Range(0, 4);

            GameObject obj        = (GameObject)Instantiate(_Agent, transform.position, Quaternion.identity);
            Seek       headingloc = obj.GetComponent <Seek>();
            headingloc.SetStartLocation(transform.position);

            switch (rand)
            {
            case 0:
            {
                headingloc.SetColour(Color.red);
                Debug.Log("Red");
            }
            break;

            case 1:
            {
                headingloc.SetColour(Color.blue);
                Debug.Log("Blue");
            }
            break;

            case 2:
            {
                headingloc.SetColour(Color.green);
                Debug.Log("Green");
            }
            break;

            case 3:
            {
                headingloc.SetColour(Color.magenta);
                Debug.Log("Magenta");
            }
            break;

            default:
                Debug.Log("Fix it felix");
                break;
            }

            _entityCountAmount += 1;
        }
    }