예제 #1
0
    private void TrySpawnUnit()
    {
        if (entityManager == null)
        {
            return;
        }

        if (_lastSpawnTime == -1 || BootStrap.EpochNow() - _lastSpawnTime > _spawnTimeMS)
        {
            _lastSpawnTime = BootStrap.EpochNow();
            var unit = GameObject.Instantiate(_spawnPrefab, transform.position, Quaternion.identity, transform.parent);
            unit.name = "Unit";
        }
    }
예제 #2
0
    private void TryAttack()
    {
        if (entityManager == null)
        {
            return;
        }

        double now = BootStrap.EpochNow();

        if (_lastAttacked == -1 || now - _lastAttacked >= _attackRateMS)
        {
            _lastAttacked = now;
            Attack();
        }
    }