Commit 15e510cd authored by Andrew Van Buren's avatar Andrew Van Buren

Adjusted walk particles and animation.

parent ae59fabf
using UnityEngine;
using System.Collections;
public class WalkParticles : MonoBehaviour {
private ParticleSystem ps;
private ParticleSystem.EmissionModule module;
private HeroMobility hm;
// Use this for initialization
void Start () {
ps = GetComponentInChildren<ParticleSystem>();
module = ps.emission;
hm = GetComponent<HeroMobility>();
}
// Update is called once per frame
void LateUpdate () {
if (hm.deltaPos.sqrMagnitude > 0) {
if (!ps.isPlaying) {
ps.Simulate(0.0f, true, false);
module.enabled = true;
ps.Play();
}
} else {
if (ps.isPlaying) {
module.enabled = false;
ps.Stop();
}
}
}
}
using UnityEngine;
using System.Collections;
public class WalkParticles : MonoBehaviour {
private ParticleSystem ps;
private ParticleSystem.EmissionModule module;
private HeroMobility hm;
public float speedThreshold = 0.001f;
// Use this for initialization
void Start () {
ps = GetComponentInChildren<ParticleSystem>();
module = ps.emission;
hm = GetComponent<HeroMobility>();
}
// Update is called once per frame
void LateUpdate () {
if (hm.deltaPos.sqrMagnitude > speedThreshold) {
if (!ps.isPlaying) {
ps.Simulate(0.0f, true, false);
module.enabled = true;
ps.Play();
}
} else {
if (ps.isPlaying) {
module.enabled = false;
ps.Stop();
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment