33 lines
998 B
C#
33 lines
998 B
C#
using System.Collections.Generic;
|
|
using Unity.Mathematics;
|
|
using UnityEngine;
|
|
|
|
namespace RebootReality.jelycho.InfectedArea {
|
|
public class InfectedAreaInfo {
|
|
public float3 Center;
|
|
public float Radius;
|
|
|
|
public ParticleSystem ParticleSystem;
|
|
}
|
|
|
|
public class InfectedAreaManager : MonoBehaviour {
|
|
[SerializeField] ParticleSystem m_ParticlesPrefab;
|
|
|
|
public readonly List<InfectedAreaInfo> InfectedAreas = new List<InfectedAreaInfo>();
|
|
|
|
public void Add(float3 center, float radius) {
|
|
ParticleSystem ps = Instantiate(m_ParticlesPrefab, center, Quaternion.identity);
|
|
ParticleSystem.ShapeModule shapeModule = ps.shape;
|
|
shapeModule.radius = radius;
|
|
ps.Play();
|
|
|
|
InfectedAreaInfo info = new InfectedAreaInfo {
|
|
Center = center,
|
|
Radius = radius,
|
|
ParticleSystem = ps
|
|
};
|
|
|
|
InfectedAreas.Add(info);
|
|
}
|
|
}
|
|
} |