/// <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; } }
// Use this for initialization void Start() { playground = this.GetComponent <ParticlePlayground.PlaygroundParticlesC> (); onFire = false; onFireElapsedTime = Random.Range(0, 40); notOnFireElapsedTime = Random.Range(0, 40); }
// 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>(); } }
// 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>(); } }
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; }
/// <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); }
/// <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(); }
/// <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); }
/// <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); }
/// <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); } }
/// <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; }
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; }
/// <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; }
/// <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); }
/// <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); }
/// <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); }
/// <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; }
/// <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; }
/// <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; }
/// <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); }
/// <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; }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <summary> /// Destroys the passed in Particle System. /// </summary> /// <param name="playgroundParticles">Playground particles.</param> public static void Destroy (PlaygroundParticlesC playgroundParticles) { PlaygroundParticlesC.Destroy(playgroundParticles); }
/// <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); }
/// <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); }
/// <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; }
/// <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); }
/// <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); }
/// <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; }