71 lines
2.1 KiB
C#
71 lines
2.1 KiB
C#
|
using System;
|
|||
|
using UnityEngine;
|
|||
|
using EvolutStudio.tinysAPI.BaseClasses;
|
|||
|
|
|||
|
namespace EvolutStudio
|
|||
|
{
|
|||
|
namespace VRPortfolioWork
|
|||
|
{
|
|||
|
namespace Components
|
|||
|
{
|
|||
|
public class SimpleParticleBurstComponent : BaseClassComponent
|
|||
|
{
|
|||
|
#region Public Attributes
|
|||
|
|
|||
|
// reference to the current selected material color
|
|||
|
public Color selectedMaterialColor;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Private Attributes
|
|||
|
|
|||
|
// private reference to the game object particle system instance
|
|||
|
private ParticleSystem _particleSystem;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Public Functions
|
|||
|
|
|||
|
public override void ValidationFailed(string notification)
|
|||
|
{
|
|||
|
throw new NotImplementedException();
|
|||
|
}
|
|||
|
|
|||
|
public override void ValidationSucceeded(string notification)
|
|||
|
{
|
|||
|
if (notification.Equals(BaseClassNotification.POINTERCLICKEVENT))
|
|||
|
{
|
|||
|
// change the particle start color
|
|||
|
var mainParticleSystem = _particleSystem.main;
|
|||
|
mainParticleSystem.startColor = selectedMaterialColor;
|
|||
|
|
|||
|
// play the burst
|
|||
|
_particleSystem.Play();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Use this for initialization
|
|||
|
public override void Init()
|
|||
|
{
|
|||
|
_ComponentsArrayIndex = modulInstance.View.RegisterComponent(this);
|
|||
|
|
|||
|
// save the reference
|
|||
|
_particleSystem = GetComponent<ParticleSystem>();
|
|||
|
|
|||
|
// update particle system start color from model
|
|||
|
var mainParticleSystem = _particleSystem.main;
|
|||
|
mainParticleSystem.startColor = selectedMaterialColor;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Private Functions
|
|||
|
|
|||
|
// Add your private functions
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|