Ejemplo n.º 1
0
		/// <summary>
		/// Sets the next thread method for an individual particle system.
		/// </summary>
		/// <param name="p">Particle Playground system.</param>
		public static void NextIndividualParticleSystemMethod (PlaygroundParticlesC p) {
			switch (p.threadMethod) {
			case ThreadMethodLocal.Inherit: p.threadMethod = ThreadMethodLocal.OnePerSystem; break;
			case ThreadMethodLocal.OnePerSystem: p.threadMethod = ThreadMethodLocal.OneForAll; break;
			case ThreadMethodLocal.OneForAll: p.threadMethod = ThreadMethodLocal.Inherit; break;
			}
		}
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     playground           = this.GetComponent <ParticlePlayground.PlaygroundParticlesC> ();
     onFire               = false;
     onFireElapsedTime    = Random.Range(0, 40);
     notOnFireElapsedTime = Random.Range(0, 40);
 }
Ejemplo n.º 3
0
	// Use this for initialization
	void Start () {
		_maxFireGun = 0;
		gunUse = true;
		firgunSize = 0;
		b = transform.FindChild("Playground Manager").FindChild ("Playground Fire").GetComponent<BoxCollider>();
		b.enabled = false;
		fireScrpit = this.transform.FindChild ("Playground Manager").transform.FindChild ("Playground Fire").GetComponent<ParticlePlayground.PlaygroundParticlesC> ();
		fireScrpit.emit = false;

				
		if (this.gameObject.tag == "playerChief") 
		{
			//monAnim = transform.FindChild("ChiefPasTouché").GetComponent<Animator>();
		}
	}
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        _maxFireGun     = 0;
        gunUse          = true;
        firgunSize      = 0;
        b               = transform.FindChild("Playground Manager").FindChild("Playground Fire").GetComponent <BoxCollider>();
        b.enabled       = false;
        fireScrpit      = this.transform.FindChild("Playground Manager").transform.FindChild("Playground Fire").GetComponent <ParticlePlayground.PlaygroundParticlesC> ();
        fireScrpit.emit = false;


        if (this.gameObject.tag == "playerChief")
        {
            //monAnim = transform.FindChild("ChiefPasTouché").GetComponent<Animator>();
        }
    }
Ejemplo n.º 5
0
		public RecordedFrame (PlaygroundParticlesC playgroundParticles, float keyframeInterval) {
			particles = new PlaybackParticle[playgroundParticles.particleCache.Length];
			for (int i = 0; i<particles.Length; i++)
			{
				particles[i] = new PlaybackParticle(
					playgroundParticles.playgroundCache.position[i],
					playgroundParticles.playgroundCache.velocity[i],
					playgroundParticles.playgroundCache.rotation[i],
					playgroundParticles.playgroundCache.size[i],
					playgroundParticles.particleCache[i].lifetime,
					playgroundParticles.particleCache[i].startLifetime,
					playgroundParticles.playgroundCache.life[i],
					playgroundParticles.playgroundCache.birth[i],
					playgroundParticles.playgroundCache.death[i],
					playgroundParticles.playgroundCache.lifetimeSubtraction[i],
					playgroundParticles.playgroundCache.color[i],
					
					playgroundParticles.playgroundCache.targetPosition[i],
					playgroundParticles.playgroundCache.initialSize[i]
					);
			}
			timeStamp = Time.realtimeSinceStartup;
			this.keyframeInterval = keyframeInterval;
		}
Ejemplo n.º 6
0
		/// <summary>
		/// Sets initial target position for this Particle System.
		/// </summary>
		/// <param name="playgroundParticles">Playground particles.</param>
		/// <param name="position">Position.</param>
		public static void SetInitialTargetPosition (PlaygroundParticlesC playgroundParticles, Vector3 position) {
			PlaygroundParticlesC.SetInitialTargetPosition(playgroundParticles,position, true);
		}
Ejemplo n.º 7
0
		/// <summary>
		/// Clears out paint in a PlaygroundParticlesC object.
		/// </summary>
		/// <param name="playgroundParticles">Playground particles.</param>
		public static void ClearPaint (PlaygroundParticlesC playgroundParticles) {
			if (playgroundParticles.paint!=null)
				playgroundParticles.paint.ClearPaint();
		}
Ejemplo n.º 8
0
		/// <summary>
		/// Live erases into a PlaygroundParticlesC PaintObject's positions, returns true if position was erased.
		/// </summary>
		/// <param name="playgroundParticles">Playground particles.</param>
		/// <param name="position">Position.</param>
		/// <param name="radius">Radius.</param>
		public static bool Erase (PlaygroundParticlesC playgroundParticles, Vector3 position, float radius) {
			return playgroundParticles.paint.Erase(position,radius);
		}
Ejemplo n.º 9
0
		/// <summary>
		/// Creates a paint object reference.
		/// </summary>
		/// <returns>The object.</returns>
		/// <param name="playgroundParticles">Playground particles.</param>
		public static PaintObjectC PaintObject (PlaygroundParticlesC playgroundParticles) {
			return PlaygroundParticlesC.NewPaintObject(playgroundParticles);
		}
Ejemplo n.º 10
0
		/// <summary>
		/// Removes the event.
		/// </summary>
		/// <param name="i">The index.</param>
		/// <param name="playgroundParticles">Playground particles.</param>
		public static void RemoveEvent (int i, PlaygroundParticlesC playgroundParticles) {
			i = i%playgroundParticles.events.Count;
			if (playgroundParticles.events.Count>0 && playgroundParticles.events[i]!=null) {
				if (playgroundParticles.events[i].target!=null) {
					for (int x = 0; x<playgroundParticles.events[i].target.eventControlledBy.Count; x++)
						if (playgroundParticles.events[i].target.eventControlledBy[x]==playgroundParticles)
							playgroundParticles.events[i].target.eventControlledBy.RemoveAt(x);
				}
				playgroundParticles.events.RemoveAt (i);
			}
		}
Ejemplo n.º 11
0
		/// <summary>
		/// Creates an event into passed particle system.
		/// </summary>
		/// <returns>The event.</returns>
		/// <param name="playgroundParticles">Particle Playground system.</param>
		public static PlaygroundEventC CreateEvent (PlaygroundParticlesC playgroundParticles) {
			if (playgroundParticles==null) return null;
			PlaygroundEventC playgroundEvent = new PlaygroundEventC();
			if (playgroundParticles.events==null)
				playgroundParticles.events = new List<PlaygroundEventC>();
			playgroundParticles.events.Add (playgroundEvent);
			return playgroundEvent;
		}
Ejemplo n.º 12
0
		public static Transform CreatePlaygroundTransform (PlaygroundParticlesC playgroundParticles) {
			Transform newTransform = CreateTransform();
			PlaygroundTransformC newPlaygroundTransform = new PlaygroundTransformC();
			newPlaygroundTransform.transform = newTransform;
			if (playgroundParticles.sourceTransforms.Count==1 && playgroundParticles.sourceTransforms[0].transform==null)
				playgroundParticles.sourceTransforms[0].transform = newTransform;
			else
				playgroundParticles.sourceTransforms.Add (newPlaygroundTransform);
			newTransform.parent = playgroundParticles.particleSystemTransform;
			newTransform.localPosition = Vector3.zero;
			newTransform.name += " "+playgroundParticles.sourceTransforms.Count.ToString();
			return newTransform;
		}
Ejemplo n.º 13
0
		/// <summary>
		/// Adds a plane collider.
		/// </summary>
		/// <returns>The PlaygroundColliderC.</returns>
		/// <param name="playgroundParticles">Playground particles.</param>
		public static PlaygroundColliderC AddCollider (PlaygroundParticlesC playgroundParticles) {
			PlaygroundColliderC pCollider = new PlaygroundColliderC();
			playgroundParticles.colliders.Add(pCollider);
			return pCollider;
		}
Ejemplo n.º 14
0
		/// <summary>
		/// Adds a single state mesh with texture and transform.
		/// </summary>
		/// <param name="playgroundParticles">Playground particles.</param>
		/// <param name="mesh">Mesh.</param>
		/// <param name="texture">Texture.</param>
		/// <param name="scale">Scale.</param>
		/// <param name="offset">Offset.</param>
		/// <param name="stateName">State name.</param>
		/// <param name="stateTransform">State transform.</param>
		public static void Add (PlaygroundParticlesC playgroundParticles, Mesh mesh, Texture2D texture, float scale, Vector3 offset, string stateName, Transform stateTransform) {
			MeshParticles.Add(playgroundParticles,mesh,texture,scale,offset,stateName,stateTransform);
		}
Ejemplo n.º 15
0
		/// <summary>
		/// Adds a single state mesh.
		/// </summary>
		/// <param name="playgroundParticles">Playground particles.</param>
		/// <param name="mesh">Mesh.</param>
		/// <param name="scale">Scale.</param>
		/// <param name="offset">Offset.</param>
		/// <param name="stateName">State name.</param>
		public static void Add (PlaygroundParticlesC playgroundParticles, Mesh mesh, float scale, Vector3 offset, string stateName) {
			MeshParticles.Add(playgroundParticles,mesh,scale,offset,stateName,null);
		}
Ejemplo n.º 16
0
		/// <summary>
		/// Adds single state image with depthmap and transform.
		/// </summary>
		/// <param name="playgroundParticles">Playground particles.</param>
		/// <param name="image">Image.</param>
		/// <param name="depthmap">Depthmap.</param>
		/// <param name="depthmapStrength">Depthmap strength.</param>
		/// <param name="scale">Scale.</param>
		/// <param name="offset">Offset.</param>
		/// <param name="stateName">State name.</param>
		/// <param name="stateTransform">State transform.</param>
		public static void Add (PlaygroundParticlesC playgroundParticles, Texture2D image, Texture2D depthmap, float depthmapStrength, float scale, Vector3 offset, string stateName, Transform stateTransform) {
			PlaygroundParticlesC.Add(playgroundParticles,image,depthmap,depthmapStrength,scale,offset,stateName,stateTransform);
		}
Ejemplo n.º 17
0
		/// <summary>
		/// Returns all current particles within a local manipulator (in form of an Event Particle, however no event will be needed).
		/// </summary>
		/// <returns>The manipulator particles.</returns>
		/// <param name="manipulator">Manipulator.</param>
		/// <param name="playgroundParticles">Playground particles.</param>
		public static List<PlaygroundEventParticle> GetManipulatorParticles (int manipulator, PlaygroundParticlesC playgroundParticles) {
			if (manipulator<0 || manipulator>=playgroundParticles.manipulators.Count) return null;
			List<PlaygroundEventParticle> particles = new List<PlaygroundEventParticle>();
			PlaygroundEventParticle particle = new PlaygroundEventParticle();
			for (int i = 0; i<playgroundParticles.particleCount; i++) {
				if (playgroundParticles.manipulators[manipulator].Contains(playgroundParticles.playgroundCache.position[i], playgroundParticles.manipulators[manipulator].transform.position)) {
					playgroundParticles.UpdateEventParticle(particle, i);
					particles.Add (particle.Clone());
				}
			}
			return particles;
		}
Ejemplo n.º 18
0
		/// <summary>
		/// Adds a plane collider and assign a transform.
		/// </summary>
		/// <returns>The PlaygroundColliderC.</returns>
		/// <param name="playgroundParticles">Playground particles.</param>
		/// <param name="transform">Transform.</param>
		public static PlaygroundColliderC AddCollider (PlaygroundParticlesC playgroundParticles, Transform transform) {
			PlaygroundColliderC pCollider = new PlaygroundColliderC();
			pCollider.transform = transform;
			playgroundParticles.colliders.Add(pCollider);
			return pCollider;
		}
Ejemplo n.º 19
0
		/// <summary>
		/// Creates a new Playground Spline. The spline will be attached to a new GameObject in your scene by the name "Playground Spline" which is parented to the passed in Particle Playground system. 
		/// The Particle Playground system will have the source spline automatically set.
		/// </summary>
		/// <returns>The Playground Spline component on the created GameObject.</returns>
		/// <param name="playgroundParticles">Particle Playground system.</param>
		public static PlaygroundSpline CreateSpline (PlaygroundParticlesC playgroundParticles) {
			PlaygroundSpline spline = CreateSpline();
			spline.Reset();
			if (playgroundParticles.splines.Count==1 && playgroundParticles.splines[0]==null)
				playgroundParticles.splines[0] = spline;
			else
				playgroundParticles.splines.Add (spline);
			spline.transform.parent = playgroundParticles.particleSystemTransform;
			spline.transform.localPosition = Vector3.zero;
			spline.name += " "+playgroundParticles.splines.Count.ToString();
			spline.AddUser(playgroundParticles.particleSystemTransform);
			return spline;
		}
Ejemplo n.º 20
0
		/// <summary>
		/// Sets amount of particles for this Particle System.
		/// </summary>
		/// <param name="playgroundParticles">Playground particles.</param>
		/// <param name="amount">Amount.</param>
		public static void SetParticleCount (PlaygroundParticlesC playgroundParticles, int amount) {
			PlaygroundParticlesC.SetParticleCount(playgroundParticles,amount);
		}
Ejemplo n.º 21
0
		/// <summary>
		/// Returns an event from PlaygroundParticlesC object in array position.
		/// </summary>
		/// <returns>The event.</returns>
		/// <param name="i">The index.</param>
		/// <param name="playgroundParticles">Particle Playground system.</param>
		public static PlaygroundEventC GetEvent (int i, PlaygroundParticlesC playgroundParticles) {
			if (playgroundParticles.events.Count>0 && playgroundParticles.events[i%playgroundParticles.events.Count]!=null)
				return playgroundParticles.events[i%playgroundParticles.events.Count];
			else return null;
		}
Ejemplo n.º 22
0
		/// <summary>
		/// Sets lifetime for this Particle System.
		/// </summary>
		/// <param name="playgroundParticles">Playground particles.</param>
		/// <param name="time">Time.</param>
		public static void SetLifetime (PlaygroundParticlesC playgroundParticles, float time) {
			PlaygroundParticlesC.SetLifetime(playgroundParticles,playgroundParticles.sorting,time);
		}
Ejemplo n.º 23
0
		/// <summary>
		/// Creates a projection object reference.
		/// </summary>
		/// <returns>The projection.</returns>
		/// <param name="playgroundParticles">Playground particles.</param>
		public static ParticleProjectionC ParticleProjection (PlaygroundParticlesC playgroundParticles)  {
			return PlaygroundParticlesC.NewProjectionObject(playgroundParticles);
		}
Ejemplo n.º 24
0
		/// <summary>
		/// Sets material for this Particle System.
		/// </summary>
		/// <param name="playgroundParticles">Playground particles.</param>
		/// <param name="particleMaterial">Particle material.</param>
		public static void SetMaterial (PlaygroundParticlesC playgroundParticles, Material particleMaterial) {
			PlaygroundParticlesC.SetMaterial(playgroundParticles, particleMaterial);
		}
Ejemplo n.º 25
0
		/// <summary>
		/// Live paints into a PlaygroundParticlesC PaintObject's positions.
		/// </summary>
		/// <param name="playgroundParticles">Playground particles.</param>
		/// <param name="position">Position.</param>
		/// <param name="normal">Normal.</param>
		/// <param name="parent">Parent.</param>
		/// <param name="color">Color.</param>
		public static int Paint (PlaygroundParticlesC playgroundParticles, Vector3 position, Vector3 normal, Transform parent, Color32 color) {
			return playgroundParticles.paint.Paint(position,normal,parent,color);
		}
Ejemplo n.º 26
0
		/// <summary>
		/// Destroys the passed in Particle System.
		/// </summary>
		/// <param name="playgroundParticles">Playground particles.</param>
		public static void Destroy (PlaygroundParticlesC playgroundParticles) {
			PlaygroundParticlesC.Destroy(playgroundParticles);
		}
Ejemplo n.º 27
0
		/// <summary>
		/// Live erases into a PlaygroundParticlesC PaintObject's using a specified index, returns true if position was erased.
		/// </summary>
		/// <param name="playgroundParticles">Playground particles.</param>
		/// <param name="index">Index.</param>
		public static bool Erase (PlaygroundParticlesC playgroundParticles, int index) {
			return playgroundParticles.paint.Erase(index);
		}
Ejemplo n.º 28
0
		/// <summary>
		/// Create a manipulator in a PlaygroundParticlesC object
		/// </summary>
		/// <returns>The ManipulatorObjectC.</returns>
		/// <param name="type">Type.</param>
		/// <param name="affects">Affects.</param>
		/// <param name="manipulatorTransform">Manipulator transform.</param>
		/// <param name="size">Size.</param>
		/// <param name="strength">Strength.</param>
		/// <param name="playgroundParticles">Playground particles.</param>
		public static ManipulatorObjectC ManipulatorObject (MANIPULATORTYPEC type, LayerMask affects, Transform manipulatorTransform, float size, float strength, PlaygroundParticlesC playgroundParticles) {
			return PlaygroundParticlesC.NewManipulatorObject(type,affects,manipulatorTransform,size,strength,playgroundParticles);
		}
Ejemplo n.º 29
0
		/// <summary>
		/// Gets the amount of paint positions in this PlaygroundParticlesC PaintObject.
		/// </summary>
		/// <returns>The paint position length.</returns>
		/// <param name="playgroundParticles">Playground particles.</param>
		public static int GetPaintPositionLength (PlaygroundParticlesC playgroundParticles) {
			return playgroundParticles.paint.positionLength;
		}
Ejemplo n.º 30
0
		/// <summary>
		/// Creates a manipulator in a PlaygroundParticlesC object by transform.
		/// </summary>
		/// <returns>The ManipulatorObjectC.</returns>
		/// <param name="manipulatorTransform">Manipulator transform.</param>
		/// <param name="playgroundParticles">Playground particles.</param>
		public static ManipulatorObjectC ManipulatorObject (Transform manipulatorTransform, PlaygroundParticlesC playgroundParticles) {
			LayerMask layerMask = -1;
			return PlaygroundParticlesC.NewManipulatorObject(MANIPULATORTYPEC.Attractor,layerMask,manipulatorTransform,1f,1f,playgroundParticles);
		}
Ejemplo n.º 31
0
		/// <summary>
		/// Sets emission for this Particle System.
		/// </summary>
		/// <param name="playgroundParticles">Playground particles.</param>
		/// <param name="emit">If set to <c>true</c> emit.</param>
		public static void Emission (PlaygroundParticlesC playgroundParticles, bool emit) {
			PlaygroundParticlesC.Emission(playgroundParticles,emit,false);
		}
Ejemplo n.º 32
0
		/// <summary>
		/// Returns a manipulator in a PlaygroundParticlesC object in array position.
		/// </summary>
		/// <returns>The ManipulatorObjectC.</returns>
		/// <param name="i">The index.</param>
		/// <param name="playgroundParticles">Playground particles.</param>
		public static ManipulatorObjectC GetManipulator (int i, PlaygroundParticlesC playgroundParticles) {
			if (playgroundParticles.manipulators.Count>0 && playgroundParticles.manipulators[i%playgroundParticles.manipulators.Count]!=null)
				return playgroundParticles.manipulators[i%playgroundParticles.manipulators.Count];
			else return null;
		}