3DTD/Assets/Scripts/Tower/Projectile.cs

23 lines
489 B
C#
Raw Normal View History

2024-04-20 15:56:26 +02:00
using UnityEngine;
using UnityEngine.Assertions;
[RequireComponent(typeof(Collider))]
public class Projectile : MonoBehaviour
{
[SerializeField, Range(0f, 1f)]
private float bounciness = 0.5f;
private Collider projCol;
private void Awake()
{
projCol = GetComponent<Collider>();
Assert.IsNotNull(projCol);
PhysicMaterial pMat = new();
pMat.bounciness = this.bounciness;
projCol.material = pMat;
}
}