- werewolf playable class - override animations for different claw styles - ninja character prefab - several assets and textures - ice shard now actually is an icicle
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class AuraEmissionFX : MonoBehaviour
|
|
{
|
|
[SerializeField] private ParticleSystem trailSystem;
|
|
[SerializeField] private ParticleSystem smokeSystem;
|
|
private ParticleSystem.EmissionModule trailEmission;
|
|
private ParticleSystem.EmissionModule smokeEmission;
|
|
|
|
[SerializeField] private ClassResource resource;
|
|
|
|
private int trailMin = 0;
|
|
private int trailMax = 10;
|
|
|
|
private int smokeMin = 0;
|
|
private int smokeMax = 30;
|
|
|
|
float resourceMax;
|
|
float normalizedValue;
|
|
|
|
private void Awake()
|
|
{
|
|
trailEmission = trailSystem.emission;
|
|
smokeEmission = smokeSystem.emission;
|
|
|
|
resource.onResourceChanged.AddListener(UpdateEmissionBasedOnValue);
|
|
}
|
|
|
|
|
|
private void UpdateEmissionBasedOnValue(float currentValue)
|
|
{
|
|
resourceMax = resource.GetMaxValue();
|
|
|
|
//trailEmission = Range[min trail, max trail] based on currentValue/resourceMax
|
|
//smokeEmission = Range[min smoke, max smoke] based on currentValue/resourceMax
|
|
|
|
normalizedValue = Mathf.Clamp01(currentValue / resourceMax);
|
|
|
|
// Update trail emission
|
|
trailEmission.rateOverTime = Mathf.Lerp(trailMin, trailMax, normalizedValue);
|
|
|
|
|
|
// Update smoke emission
|
|
smokeEmission.rateOverTime = Mathf.Lerp(smokeMin, smokeMax, normalizedValue);
|
|
|
|
}
|
|
}
|