23 lines
489 B
C#
23 lines
489 B
C#
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;
|
|
}
|
|
}
|