mirror of
https://github.com/ryzij/Cube-Tower-Defense.git
synced 2026-07-14 01:56:57 +00:00
Небольшие изменения
This commit is contained in:
@@ -4,7 +4,7 @@ public class TurretBullet : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float _damage = 1f;
|
||||
[SerializeField] private float _speed = 5f;
|
||||
[SerializeField] private float _distance = 3f;
|
||||
[SerializeField] private float _distance;
|
||||
|
||||
private Vector3 _spawnPos;
|
||||
|
||||
@@ -22,4 +22,15 @@ public class TurretBullet : MonoBehaviour
|
||||
if (Vector3.Distance(transform.position, _spawnPos) > _distance)
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
public TurretBullet Spawn(Turret turret, Vector3 direction)
|
||||
{
|
||||
var rot = turret.transform.rotation;
|
||||
rot.SetLookRotation(direction);
|
||||
var bullet = Instantiate(this, turret.transform.position, rot, turret.transform);
|
||||
bullet._damage += turret.Damage;
|
||||
bullet._distance += turret.Distance;
|
||||
|
||||
return bullet;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user