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"; } }
private void TryAttack() { if (entityManager == null) { return; } double now = BootStrap.EpochNow(); if (_lastAttacked == -1 || now - _lastAttacked >= _attackRateMS) { _lastAttacked = now; Attack(); } }