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 UnityEngine;
using System.Collections; using System.Collections;
public class WalkParticles : MonoBehaviour { public class WalkParticles : MonoBehaviour {
private ParticleSystem ps; private ParticleSystem ps;
private ParticleSystem.EmissionModule module; private ParticleSystem.EmissionModule module;
private HeroMobility hm; private HeroMobility hm;
public float speedThreshold = 0.001f;
// Use this for initialization
void Start () { // Use this for initialization
ps = GetComponentInChildren<ParticleSystem>(); void Start () {
module = ps.emission; ps = GetComponentInChildren<ParticleSystem>();
hm = GetComponent<HeroMobility>(); module = ps.emission;
} hm = GetComponent<HeroMobility>();
}
// Update is called once per frame
void LateUpdate () { // Update is called once per frame
if (hm.deltaPos.sqrMagnitude > 0) { void LateUpdate () {
if (!ps.isPlaying) { if (hm.deltaPos.sqrMagnitude > speedThreshold) {
ps.Simulate(0.0f, true, false); if (!ps.isPlaying) {
module.enabled = true; ps.Simulate(0.0f, true, false);
ps.Play(); module.enabled = true;
} ps.Play();
} else { }
if (ps.isPlaying) { } else {
module.enabled = false; if (ps.isPlaying) {
ps.Stop(); 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