39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace DefaultNamespace.NonSolid
|
|
{
|
|
public class AreaOfEffect : MonoBehaviour
|
|
{
|
|
public enum AreaOfEffectType
|
|
{
|
|
Circle,
|
|
Rectangle,
|
|
Pentagon,
|
|
Hexagon,
|
|
}
|
|
|
|
[SerializeField] private AreaOfEffectType _areaOfEffectType;
|
|
[SerializeField] private float _radius;
|
|
|
|
private void OnCollisionEnter(Collision other)
|
|
{
|
|
float area = 0.0f;
|
|
|
|
switch (_areaOfEffectType)
|
|
{
|
|
case AreaOfEffectType.Circle:
|
|
area = Mathf.Pow(_radius, 2.0f) * Mathf.PI;
|
|
break;
|
|
case AreaOfEffectType.Rectangle:
|
|
break;
|
|
case AreaOfEffectType.Pentagon:
|
|
break;
|
|
case AreaOfEffectType.Hexagon:
|
|
break;
|
|
default:
|
|
throw new ArgumentOutOfRangeException();
|
|
}
|
|
}
|
|
}
|
|
} |