Commit 269232c6 authored by Jordan McKenney's avatar Jordan McKenney

Merge branch 'character' of git.gmu.edu:gadig/four into character

parents 5ab16613 15e510cd
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