Subversion Repository Public Repository

Nextrek

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 *
 *	Adventure Creator
 *	by Chris Burton, 2013-2014
 *	
 *	"ParticleSwitch.cs"
 * 
 *	This can be used, via the Object: Send Message Action,
 *	to turn it's attached particle systems on and off.
 * 
 */

using UnityEngine;
using System.Collections;

public class ParticleSwitch : MonoBehaviour
{
	
	public bool enableOnStart = false;
	
	
	private void Awake ()
	{
		Switch (enableOnStart);
	}
	
	
	public void TurnOn ()
	{
		Switch (true);
	}
	
	
	public void TurnOff ()
	{
		Switch (false);
	}


	public void Interact ()
	{
		if (this.particleSystem)
		{
			this.particleSystem.Emit (this.particleSystem.maxParticles);
		}
	}
	
	
	private void Switch (bool turnOn)
	{
		if (this.particleSystem)
		{
			if (turnOn)
			{
				this.particleSystem.Play ();
			}
			else
			{
				this.particleSystem.Stop ();
			}
		}
	}
	
}

Commits for Nextrek/SpaceCrew/SpaceCrew/Assets/AdventureCreator/Scripts/Object/ParticleSwitch.cs

Diff revisions: vs.
Revision Author Commited Message
83 FMMortaroli picture FMMortaroli Tue 13 May, 2014 11:32:51 +0000