예제 #1
0
 private void CreateVirus()
 {
     _currentTimeVirus += Time.deltaTime;
     if (_currentTimeVirus > timeGenerateVirus)
     {
         Rigidbody2D currentVirus = Instantiate(virus, GetPosition(), Quaternion.identity).GetComponent <Rigidbody2D>();
         currentVirus.AddForce(((Vector2)player.position - currentVirus.position).normalized * virus.GetSpeed(), ForceMode2D.Impulse);
         _currentTimeVirus = 0;
     }
 }