Esempio n. 1
0
	void OnEnable () 
	{
		if (particles == null)
			particles = GetComponent<PlaygroundParticlesC>();

		particles.particleMask = particles.particleCount;
	}
    int snapshotToLoad = 1;                             // The current snapshot to load when spacebar is pressed

    void Start()
    {
        if (particles == null)
        {
            particles = GetComponent <PlaygroundParticlesC>();
        }
    }
Esempio n. 3
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;
        }
Esempio n. 4
0
    void GenerateScatter()
    {
        if (!applyPositionScatter)
        {
            return;
        }

        _scatterPosition = new Vector3[particles.particleCount];
        System.Random random = new System.Random();
        for (int p = 0; p < _scatterPosition.Length; p++)
        {
            if (positionScatterMethod == MINMAXVECTOR3METHOD.Rectangular)
            {
                _scatterPosition[p] = PlaygroundParticlesC.RandomRange(random, positionScatterMin, positionScatterMax);
            }
            else if (positionScatterMethod == MINMAXVECTOR3METHOD.RectangularLinear)
            {
                _scatterPosition[p] = Vector3.Lerp(positionScatterMin, positionScatterMax, (p * 1f) / (_scatterPosition.Length * 1f));
            }
            else if (positionScatterMethod == MINMAXVECTOR3METHOD.Spherical)
            {
                _scatterPosition[p] = PlaygroundParticlesC.RandomRangeSpherical(random, positionScatterMin.x, positionScatterMax.x);
            }
            else if (positionScatterMethod == MINMAXVECTOR3METHOD.SphericalLinear)
            {
                _scatterPosition[p] = PlaygroundParticlesC.RandomRangeSpherical(random, positionScatterMin.x, positionScatterMax.x, (p * 1f) / (_scatterPosition.Length * 1f));
            }
        }
    }
    IEnumerator Start()
    {
        particles = GetComponent <PlaygroundParticlesC>();
        yield return(null);

        StartCoroutine(Emit());
    }
Esempio n. 6
0
    // Instantiate a preset by name reference
    public static PlaygroundParticlesC InstantiateEditorPreset(Object presetObject)
    {
        GameObject           presetGo        = (GameObject)Instantiate(presetObject);
        PlaygroundParticlesC presetParticles = presetGo.GetComponent <PlaygroundParticlesC>();

        if (presetParticles != null)
        {
            if (PlaygroundC.reference == null)
            {
                PlaygroundC.ResourceInstantiate("Playground Manager");
            }
            if (PlaygroundC.reference)
            {
                if (PlaygroundC.reference.autoGroup && presetParticles.particleSystemTransform.parent == null)
                {
                    presetParticles.particleSystemTransform.parent = PlaygroundC.referenceTransform;
                }
                PlaygroundC.particlesQuantity++;
                //PlaygroundC.reference.particleSystems.Add(presetParticles);
                presetParticles.particleSystemId = PlaygroundC.particlesQuantity;
            }
            presetGo.name = presetObject.name;
            return(presetParticles);
        }
        else
        {
            return(null);
        }
    }
 void Start()
 {
     particles      = GetComponent <PlaygroundParticlesC>();
     thisTransform  = transform;
     isSameLifetime = minimumLifetime == maximumLifetime;
     StartCoroutine(Shoot());
 }
Esempio n. 8
0
        /****************************************************************************
        *       Monobehaviours
        ****************************************************************************/

        void OnEnable()
        {
            if (playgroundSystem == null)
            {
                playgroundSystem = GetComponent <PlaygroundParticlesC>();
            }
            if (Application.isPlaying && recordedFrames == null)
            {
                if (recorderData != null)
                {
                    _hasRecorderData = true;
                    if (multithreading)
                    {
                        LoadAsync();
                    }
                    else
                    {
                        Load();
                    }
                }
                else
                {
                    recordedFrames       = new List <RecordedFrame>();
                    _hasEditedRecordData = true;
                }
            }

            _hasPlaygroundSystem = playgroundSystem != null;
        }
	PlaygroundParticlesC particles;							// Private reference to the particle system
	
	IEnumerator Start () {

		// Get a reference to the particle system
		if (particles==null)
			particles = GetComponent<PlaygroundParticlesC>();

		// Make sure this particle system is reset (upon repeat)
		particles.emit = true;
		particles.turbulenceStrength = 0;

		// Wait before increasing turbulence strength
		yield return new WaitForSeconds(waitBeforeTurbulence);

		// Increase turbulence strength
		while (particles.turbulenceStrength<turbulenceMaxStrength) {
			particles.turbulenceStrength += turbulenceIncreaseSpeed*Time.deltaTime;
			yield return null;
		}

		// Wait before emission stop
		yield return new WaitForSeconds(waitBeforeStopEmission);

		// Stop emission
		particles.emit = false;

		// Wait to continue when sequence is done (could for instance be the lifetime of particles)
		yield return new WaitForSeconds(waitWhenDone);

		// Repeat
		if (repeat)
			StartCoroutine(Start());
		else {
			//If not repeating, add Application.LoadLevel("Your Scene Name") here for instance
		}
	}
Esempio n. 10
0
    public PlaygroundParticlesC particles;                              // The particle system reference

    void Start()
    {
        // Try to get the PlaygroundParticlesC component from this object if set to null
        if (particles == null)
        {
            particles = GetComponent <PlaygroundParticlesC>();
        }
    }
    public Color32 color = Color.white;         // Set color in Inspector

    void Start()
    {
        // Assume script is assigned to particle system's GameObject if particles is null
        if (particles == null)
        {
            particles = GetComponent <PlaygroundParticlesC>();
        }
    }
Esempio n. 12
0
 public void ScaleStateSizeOnEnable()
 {
     if (particles==null)
         particles = GetComponent<PlaygroundParticlesC>();
     foreach (ParticleStateC activeState in particles.states) {
         origStateScale = activeState.stateScale;
     }
 }
 public override void OnStart()
 {
     base.OnStart();
     _camera = GameMainReferences.Instance.RTSCamera.transform;
     _player = GameMainReferences.Instance.PlayerController.Entity;
     _containerCanavasGroup = _container.GetComponent<CanvasGroup>();
     _particles = _particleField.GetComponentInChildren<PlaygroundParticlesC>();
 }
Esempio n. 14
0
    public float angle    = 90f;                                // Angle from object to particle system

    void Start()
    {
        // Try assigning from this GameObject if particles is null
        if (particles == null)
        {
            particles = GetComponent <PlaygroundParticlesC>();
        }
    }
Esempio n. 15
0
 void Start()
 {
     // Assume this GameObect is particles is not assigned
     if (particles == null)
     {
         particles = GetComponent <PlaygroundParticlesC>();
     }
 }
    public void CreatePresetObject(int i)
    {
        PlaygroundParticlesC instantiatedPreset = PlaygroundC.InstantiatePreset(presetObjects[i].presetObject.name);

        if (instantiatedPreset)
        {
            Selection.activeGameObject = instantiatedPreset.particleSystemGameObject;
        }
    }
 public void ScaleManipulatorSizeOnEnable()
 {
     if (particles==null)
         particles = GetComponent<PlaygroundParticlesC>();
     foreach (ManipulatorObjectC manipulator in particles.manipulators) {
         origManiScale = manipulator.size;
         origManiStrength = manipulator.strength;
     }
 }
Esempio n. 18
0
    void OnEnable()
    {
        if (particles == null)
        {
            particles = GetComponent <PlaygroundParticlesC>();
        }

        particles.particleMask = particles.particleCount;
    }
Esempio n. 19
0
	void Start () {
		if (particles==null)
			particles = GetComponent<PlaygroundParticlesC>();
		if (movingTransform==null)
			movingTransform = transform;
		if (particles!=null&&movingTransform!=null)
			isReady = true;
		previousPosition = movingTransform.position;
	}
 public override void Initialize(EffectSetting effectSetting)
 {
     base.Initialize(effectSetting);
     if (particles == null)
         particles = GetComponent<PlaygroundParticlesC>();
     if (movingTransform == null)
         movingTransform = transform;
     if (particles != null && movingTransform != null)
         isReady = true;
 }
Esempio n. 21
0
//	private float m_Multiplier;

    public void Awake()
    {
        m_Sprite               = transform.GetComponentInChildren <SpriteRenderer>();
        m_LineRenderer         = transform.GetComponentInChildren <LineRenderer>();
        m_Particles            = transform.GetComponentInChildren <PlaygroundParticlesC>();
        m_ManipulatorTransform = m_Particles.transform.FindChild("Manipulator");

        m_ManipulatorObstruction = PlaygroundC.GetManipulator(0, m_Particles);
        m_ManipulatorColor       = PlaygroundC.GetManipulator(1, m_Particles);
    }
	void OnEnable () {
		if (particles==null)
			particles = GetComponent<PlaygroundParticlesC>();
		origVelocityScale = particles.velocityScale;
		origScale = particles.scale;
		origLifetimePositioningScale = particles.lifetimePositioningScale;
		origOverflowOffset = particles.overflowOffset;
		origSourceScatterMin = particles.sourceScatterMin;
		origSourceScatterMax = particles.sourceScatterMax;
	}
Esempio n. 23
0
 public void ScaleStateSizeOnEnable()
 {
     if (particles == null)
     {
         particles = GetComponent <PlaygroundParticlesC>();
     }
     foreach (ParticleStateC activeState in particles.states)
     {
         origStateScale = activeState.stateScale;
     }
 }
Esempio n. 24
0
    void Awake()
    {
        imageColor = new Color(0f, 0f, 0f, 0f);
        ppc        = logoParticle.GetComponent <PlaygroundParticlesC>();
        Debug.Log("ppc.emit : " + ppc.emit);
        ppc.emit = false;

        var updateStream = Observable
                           .EveryUpdate()
                           .TakeWhile(_ => elapsedTime < sceneTransitionTime)
                           .Finally(() => SceneManager.LoadScene("CubeField"))
                           .Subscribe(_ => { elapsedTime += Time.deltaTime; });

        // Logo Image Fade In Stream
        Observable
        .Timer(TimeSpan.FromMilliseconds(0), TimeSpan.FromSeconds(logoFadeInStartTime))
        .Skip(1)
        .First()
        .Subscribe(_ => {
            Observable
            .EveryUpdate()
            .TakeWhile(__ => imageColor.a != 1f)
            .Subscribe(__ => {
                float rate      = Mathf.Clamp((elapsedTime - logoFadeInStartTime) / logoFadeInTime, 0f, 1f);
                imageColor.a    = rate;
                logoImage.color = imageColor;
            });
        });

        // Logo Image Fade Out Stream
        Observable
        .Timer(TimeSpan.FromMilliseconds(0), TimeSpan.FromSeconds(logoFadeOutStartTime))
        .Skip(1)
        .First()
        .Subscribe(_ => {
            Observable
            .EveryUpdate()
            .TakeWhile(__ => imageColor.a != 0f)
            .Subscribe(__ => {
                float rate      = 1f - Mathf.Clamp((elapsedTime - logoFadeOutStartTime) / logoFadeOutTime, 0f, 1f);
                imageColor.a    = rate;
                logoImage.color = imageColor;
            });
        });

        // Particle Stream
        Observable
        .Timer(TimeSpan.FromMilliseconds(0), TimeSpan.FromSeconds(particleStartTime))
        .Skip(1)
        .First()
        .Subscribe(_ => {
            ppc.emit = true;
        });
    }
		void Start () {

				// Cache the particle system (make sure you have set enough particle count)
				particles = GetComponent<PlaygroundParticlesC>();

				// Create a new skinned world object
				swo = PlaygroundC.SkinnedWorldObject(skinnedMeshTransform);

				// Start emission routine
				StartCoroutine(EmitOverAllVertices());
		}
    void Start()
    {
        // Cache the particle system (make sure you have set enough particle count)
        particles = GetComponent <PlaygroundParticlesC>();

        // Create a new skinned world object
        swo = PlaygroundC.SkinnedWorldObject(skinnedMeshTransform);

        // Start emission routine
        StartCoroutine(EmitOverAllVertices());
    }
        /// <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;
            }
        }
Esempio n. 28
0
 void Start()
 {
     if (isOldEffect)
     {
         particleM = particleObj.GetComponent <WarpWindManager>();
     }
     iCamera = cameraObj.GetComponent(typeof(ICamera)) as ICamera;
     if (viralSpiral)
     {
         ppc = viralSpiral.GetComponent <PlaygroundParticlesC>();
     }
 }
	PlaygroundParticlesC particles;		// Cached reference to the particle system

	IEnumerator Start () {

		// Cache a reference to the particle system
		particles = GetComponent<PlaygroundParticlesC>();

		// Set a particle as sticky if a negative value isn't set
		if (stickyParticle>-1) {
			while (!particles.IsReady())
				yield return null;
			particles.SetSticky (stickyParticle, stickyTransform.position+stickyOffset, stickyTransform.up, particles.stickyCollisionsSurfaceOffset, stickyTransform);
		}
	}
Esempio n. 30
0
 public void ParticleScaleOnEnable()
 {
     if (particles == null)
     {
         particles = GetComponent <PlaygroundParticlesC>();
     }
     origVelocityScale            = particles.velocityScale;
     origScale                    = particles.scale;
     origLifetimePositioningScale = particles.lifetimePositioningScale;
     origOverflowOffset           = particles.overflowOffset;
     origScatterScale             = particles.scatterScale;
 }
 public void ScaleManipulatorSizeOnEnable()
 {
     if (particles == null)
     {
         particles = GetComponent <PlaygroundParticlesC>();
     }
     foreach (ManipulatorObjectC manipulator in particles.manipulators)
     {
         origManiScale    = manipulator.size;
         origManiStrength = manipulator.strength;
     }
 }
Esempio n. 32
0
 public override void Initialize(EffectSetting effectSetting)
 {
     base.Initialize(effectSetting);
     _rayMotor = effectSetting.GetComponentsInChildren<RayCastMotor>(true)[0];
     _particles = GetComponent<PlaygroundParticlesC>();
     _particles.applyParticleMask = true;
     _particles.overflowOffset.z = _rayMotor.MaxDistance / (1 + _particles.particleCount);
     if (_rayMotor == null)
     {
         Debug.LogError("Beam Chaser cannot find raycast motor! spell: " + effectSetting.spell);
     }
 }
    public void CreatePreset()
    {
        // Try to child all connected objects to the particle system
        PlaygroundParticlesC ppScript = particleSystemObject.GetComponent <PlaygroundParticlesC>();

        int i = 0;

        for (; i < ppScript.manipulators.Count; i++)
        {
            if (ppScript.manipulators[i].transform)
            {
                ppScript.manipulators[i].transform.parent = particleSystemObject.transform;
            }
        }
        for (i = 0; i < ppScript.paint.paintPositions.Count; i++)
        {
            if (ppScript.paint.paintPositions[i].parent)
            {
                ppScript.paint.paintPositions[i].parent.parent = particleSystemObject.transform;
            }
        }
        for (i = 0; i < ppScript.states.Count; i++)
        {
            if (ppScript.states[i].stateTransform)
            {
                ppScript.states[i].stateTransform.parent = particleSystemObject.transform;
            }
        }
        if (ppScript.sourceTransform)
        {
            ppScript.sourceTransform.parent = particleSystemObject.transform;
        }
        if (ppScript.worldObject.transform)
        {
            ppScript.worldObject.transform.parent = particleSystemObject.transform;
        }
        if (ppScript.skinnedWorldObject.transform)
        {
            ppScript.skinnedWorldObject.transform.parent = particleSystemObject.transform;
        }

        // Save it as prefab in presetPath and import
        GameObject particleSystemPrefab = PrefabUtility.CreatePrefab(PlaygroundParticleWindowC.playgroundPath + PlaygroundParticleWindowC.presetPath + particleSystemObject.name + ".prefab", particleSystemObject, ReplacePrefabOptions.Default);

        AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(particleSystemIcon as UnityEngine.Object), PlaygroundParticleWindowC.playgroundPath + PlaygroundParticleWindowC.iconPath + particleSystemPrefab.name + ".png");
        AssetDatabase.ImportAsset(PlaygroundParticleWindowC.playgroundPath + PlaygroundParticleWindowC.iconPath + particleSystemPrefab.name + ".png");

        // Close window
        window.Close();
    }
 string SourceMethod(PlaygroundParticlesC source)
 {
     string returnString;
     switch (source.source) {
     case SOURCEC.Paint:returnString = "painted";break;
     case SOURCEC.Projection:returnString = "projected";break;
     case SOURCEC.SkinnedWorldObject:returnString = "skinned mesh";break;
     case SOURCEC.State:returnString = "state";break;
     case SOURCEC.Transform:returnString = "transform";break;
     case SOURCEC.WorldObject:returnString = "mesh";break;
     case SOURCEC.Script:returnString =(source.eventControlledBy.Count>0)? "event" : "scripted";break;
     default:returnString = "";break;
     }
     return returnString;
 }
Esempio n. 35
0
    PlaygroundParticlesC particles;             // Cached reference to the particle system

    IEnumerator Start()
    {
        // Cache a reference to the particle system
        particles = GetComponent <PlaygroundParticlesC>();

        // Set a particle as sticky if a negative value isn't set
        if (stickyParticle > -1)
        {
            while (!particles.IsReady())
            {
                yield return(null);
            }
            particles.SetSticky(stickyParticle, stickyTransform.position + stickyOffset, stickyTransform.up, particles.stickyCollisionsSurfaceOffset, stickyTransform);
        }
    }
Esempio n. 36
0
    //private ParticleSystem.MainModule _mainModule;

    // Use this for initialization
    void Start()
    {
        this._particleSystem = GetComponent <PlaygroundParticlesC>();
        this._particleSystem.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
        this.trailScript          = GetComponent <PlaygroundTrails>() as PlaygroundTrails;
        this._particleSystem.emit = false;
        this._active        = false;
        this._scatterSize   = 0.2f;
        this._particleScale = 0.2f;
        this.Scale(_scatterSize);
        this._gradient = new Gradient();
        this._gradient.SetKeys(_gradient.colorKeys, _alphaKeys);
        InvokeRepeating("Shrink", 0.0f, 0.01f);
        InvokeRepeating("FadeToGray", 0.0f, 0.1f);
    }
Esempio n. 37
0
 void Start()
 {
     if (particles == null)
     {
         particles = GetComponent <PlaygroundParticlesC>();
     }
     if (movingTransform == null)
     {
         movingTransform = transform;
     }
     if (particles != null && movingTransform != null)
     {
         isReady = true;
     }
     previousPosition = movingTransform.position;
 }
	public Color color = Color.white;				// Color to paint with

	// Use this for initialization
	void Start () {

		// Get reference to particle system on GameObject if null
		if (particles==null)
			particles = GetComponent<PlaygroundParticlesC>();
		if (particles!=null) {

			// Make sure particles are set to paint and has chosen collision type
			particles.source = SOURCEC.Paint;
			particles.paint.collisionType = collisionType;

			// Set delta movement to false, otherwise paint will make particles fly on initiation
			particles.calculateDeltaMovement = false;
		} else {
			Debug.Log("Please assign a particle system to this script.", gameObject);
		}
	}
Esempio n. 39
0
    public virtual void Awake()
    {
        m_PigmentCircle        = transform.FindChild("Pigment Circle").GetComponent <SpriteRenderer>();
        m_PigmentRing          = transform.FindChild("Pigment Ring").GetComponent <SpriteRenderer>();
        m_CromaticRing         = transform.FindChild("Cromatic Ring").GetComponent <SpriteRenderer>();
        m_Raycast              = transform.FindChild("Raycast");
        m_Particles            = m_Raycast.GetComponentInChildren <PlaygroundParticlesC>();
        m_ManipulatorTransform = m_Particles.transform.FindChild("Manipulator");
        m_LineRenderer         = m_Raycast.GetComponentInChildren <LineRenderer>();
        m_Output = m_Raycast.GetComponentInChildren <SpriteRenderer>();

        m_ManipulatorObstruction = PlaygroundC.GetManipulator(0, m_Particles);
        m_ManipulatorColor       = PlaygroundC.GetManipulator(1, m_Particles);

        m_ParticleRing = GetComponentInChildren <ParticleSystem>();
        m_SoundSource  = GetComponent <AudioSource>();
    }
Esempio n. 40
0
    IEnumerator Start()
    {
        PlaygroundParticlesC particles = GetComponent <PlaygroundParticlesC>();

        while (!particles.IsReady())
        {
            yield return(null);
        }

        Vector3 position = particles.particleSystemTransform.position;

        for (int i = 0; i < particles.particleCount; i++)
        {
            float   iCircle   = 360f * ((i * 1f) / (particles.particleCount * 1f));
            Vector3 direction = new Vector3(Mathf.Cos(Mathf.Deg2Rad * iCircle) * width, Mathf.Sin(Mathf.Deg2Rad * iCircle) * height, 0);
            particles.Emit(position, direction * velocity, color);
        }
    }
Esempio n. 41
0
	// Update is called once per frame
	void Update () {

        if (Input.GetMouseButton(0) && GameManager.instance.m_CanPlay)
        {
            if (m_TouchStates == TouchStates.NOTOUCH)
                { 
                    m_TouchStates = TouchStates.TOUCHED;

                    m_Trail = m_HypnoticPrefab.gameObject.GetComponent<PlaygroundTrails>();

                    m_Trail.lifetimeColor = Gradients[Random.Range(0, Gradients.Length + 1)];
                    m_HypnoticInstance = Instantiate(m_HypnoticPrefab, new Vector3(Input.mousePosition.x, Input.mousePosition.z,0), Quaternion.identity) as PlaygroundParticlesC;
                    StartCoroutine(Effects());

                Score.SetActive(true);
                    
                }

            if(m_HypnoticInstance!=null)
            {
                Vector3 mousePos = Input.mousePosition;
                mousePos.z = +10;       // we want 2m away from the camera position
                Vector3 objectPos = m_Camera.ScreenToWorldPoint(mousePos);
                m_HypnoticInstance.transform.position = objectPos;

                GameManager.instance.m_PlayerBusy = true;
            }

            



        }
        else
        {
            if(m_TouchStates == TouchStates.TOUCHED)
            {
                m_TouchStates = TouchStates.RELEASE;
                m_HypnoticInstance.gameObject.GetComponent<Animator>().SetTrigger("Destroy");
                StartCoroutine(WaitForEnd());
                
            }
        }
    }
Esempio n. 42
0
    public void Awake()
    {
        m_RaycastLeft  = transform.FindChild("RaycastLeft");
        m_RaycastRight = transform.FindChild("RaycastRight");

        m_LineRendererLeft  = m_RaycastLeft.GetComponentInChildren <LineRenderer>();
        m_LineRendererRight = m_RaycastRight.GetComponentInChildren <LineRenderer>();

        m_ParticleLeft  = m_RaycastLeft.GetComponentInChildren <PlaygroundParticlesC>();
        m_ParticleRight = m_RaycastRight.GetComponentInChildren <PlaygroundParticlesC>();

        m_ManipulatorLeft  = m_ParticleLeft.transform.FindChild("Manipulator");
        m_ManipulatorRight = m_ParticleRight.transform.FindChild("Manipulator");

        m_ManipulatorObstuctionLeft  = PlaygroundC.GetManipulator(0, m_ParticleLeft);
        m_ManipulatorObstuctionRight = PlaygroundC.GetManipulator(0, m_ParticleRight);

        m_ManipulatorColorLeft  = PlaygroundC.GetManipulator(1, m_ParticleLeft);
        m_ManipulatorColorRight = PlaygroundC.GetManipulator(1, m_ParticleRight);
    }
Esempio n. 43
0
    public void Awake()
    {
        switch (type)
        {
        case PipeType.Entry:
//			m_Particles = GetComponentInChildren<PlaygroundParticlesC>();
            theSprite.color = new Color(0, 0, 0, 0);
            break;

        case PipeType.Exit:
            m_Raycast              = transform.FindChild("Raycast");
            m_LineRenderer         = m_Raycast.GetComponentInChildren <LineRenderer>();
            m_Particles            = GetComponentInChildren <PlaygroundParticlesC>();
            m_ManipulatorTransform = m_Particles.transform.FindChild("Manipulator");

            m_ManipulatorObstruction = PlaygroundC.GetManipulator(0, m_Particles);
            m_ManipulatorColor       = PlaygroundC.GetManipulator(1, m_Particles);
            break;
        }
    }
    // Use this for initialization
    void Start()
    {
        m_goal    = GameObject.Find("particles_goal").GetComponent <PlaygroundParticlesC>();
        m_hots[1] = GameObject.Find("highlight_stick").GetComponent <PlaygroundParticlesC>();
        m_hots[2] = GameObject.Find("highlight_pad").GetComponent <PlaygroundParticlesC>();
        m_hots[3] = GameObject.Find("highlight_glove").GetComponent <PlaygroundParticlesC>();

        //hot Audio source
        m_hots_audioSource[1] = GameObject.Find("model_goalie_stick_v1").GetComponent <AudioSource>();
        m_hots_audioSource[2] = GameObject.Find("Goalie_Pad_Hand").GetComponent <AudioSource>();
        m_hots_audioSource[3] = GameObject.Find("dummy_glove").GetComponent <AudioSource>();

        //hot haptics
        m_hots_grabbable[1] = m_hots_audioSource[2].GetComponent <VRTK.script_grabbable>(); // stick and pad share the same grabbable
        m_hots_grabbable[2] = m_hots_audioSource[2].GetComponent <VRTK.script_grabbable>();
        m_hots_grabbable[3] = m_hots_audioSource[3].GetComponent <VRTK.script_grabbable>();

        //
        m_manager_audio = GameObject.Find("Manager_Gameplay").GetComponent <script_manager_audio>();
    }
	void Start () {
		particles = GetComponent<PlaygroundParticlesC>();
		laserColor = particles.lifetimeColor;
		previousParticleCount = particleCount;
	}
Esempio n. 46
0
	public Color32 color = Color.white; 	// Set color in Inspector

	void Start () {

		// Assume script is assigned to particle system's GameObject if particles is null
		if (particles==null)
			particles = GetComponent<PlaygroundParticlesC>();
	}
	void Start () {
		particles = GetComponent<PlaygroundParticlesC>();
		cameraTransform = Camera.main.transform;
	}
	int snapshotToLoad = 1;						// The current snapshot to load when spacebar is pressed

	void Start () {
		if (particles==null)
			particles = GetComponent<PlaygroundParticlesC>();
	}
	void OnEnable () {

		lastActiveTool = Tools.current;
		
		// Playground Particles
		playgroundParticlesScriptReference = target as PlaygroundParticlesC;
		playgroundParticles = new SerializedObject(playgroundParticlesScriptReference);
		
		shurikenRenderer = playgroundParticlesScriptReference.particleSystemGameObject.particleSystem.renderer as ParticleSystemRenderer;
		
		manipulators = playgroundParticles.FindProperty("manipulators");
		events = playgroundParticles.FindProperty("events");
		snapshots = playgroundParticles.FindProperty("snapshots");
		source = playgroundParticles.FindProperty("source");
		sorting = playgroundParticles.FindProperty("sorting");
		lifetimeSorting = playgroundParticles.FindProperty("lifetimeSorting");
		nearestNeighborOrigin = playgroundParticles.FindProperty("nearestNeighborOrigin");
		activeState = playgroundParticles.FindProperty("activeState");
		particleCount = playgroundParticles.FindProperty("particleCount");
		emissionRate = playgroundParticles.FindProperty("emissionRate");
		updateRate = playgroundParticles.FindProperty("updateRate");
		emit = playgroundParticles.FindProperty("emit");
		loop = playgroundParticles.FindProperty("loop");
		disableOnDone = playgroundParticles.FindProperty("disableOnDone");
		calculate = playgroundParticles.FindProperty("calculate");
		deltaMovementStrength = playgroundParticles.FindProperty("deltaMovementStrength");
		particleTimescale = playgroundParticles.FindProperty("particleTimescale");
		sizeMin = playgroundParticles.FindProperty("sizeMin");
		sizeMax = playgroundParticles.FindProperty("sizeMax");
		overflowOffset = playgroundParticles.FindProperty("overflowOffset");
		overflowMode = playgroundParticles.FindProperty("overflowMode");
		lifetime = playgroundParticles.FindProperty("lifetime");
		lifetimeSize = playgroundParticles.FindProperty("lifetimeSize");
		turbulenceLifetimeStrength = playgroundParticles.FindProperty("turbulenceLifetimeStrength");
		lifetimeVelocity = playgroundParticles.FindProperty("lifetimeVelocity");
		initialVelocityShape = playgroundParticles.FindProperty("initialVelocityShape");
		initialVelocityMin = playgroundParticles.FindProperty("initialVelocityMin");
		initialVelocityMax = playgroundParticles.FindProperty("initialVelocityMax");
		initialLocalVelocityMin = playgroundParticles.FindProperty("initialLocalVelocityMin");
		initialLocalVelocityMax = playgroundParticles.FindProperty("initialLocalVelocityMax");
		lifetimeColor = playgroundParticles.FindProperty("lifetimeColor");
		lifetimeColors = playgroundParticles.FindProperty ("lifetimeColors");
		colorSource = playgroundParticles.FindProperty("colorSource");
		collision = playgroundParticles.FindProperty("collision");
		affectRigidbodies = playgroundParticles.FindProperty("affectRigidbodies");
		mass = playgroundParticles.FindProperty("mass");
		collisionRadius = playgroundParticles.FindProperty("collisionRadius");
		collisionMask = playgroundParticles.FindProperty("collisionMask");
		collisionType = playgroundParticles.FindProperty("collisionType");
		bounciness = playgroundParticles.FindProperty("bounciness");
		states = playgroundParticles.FindProperty("states");
		worldObject = playgroundParticles.FindProperty("worldObject");
		skinnedWorldObject = playgroundParticles.FindProperty("skinnedWorldObject");
		sourceTransform = playgroundParticles.FindProperty("sourceTransform");
		worldObjectUpdateVertices = playgroundParticles.FindProperty ("worldObjectUpdateVertices");
		worldObjectUpdateNormals = playgroundParticles.FindProperty("worldObjectUpdateNormals");
		sourcePaint = playgroundParticles.FindProperty("paint");
		sourceProjection = playgroundParticles.FindProperty("projection");
		lifetimeStretching = playgroundParticles.FindProperty("stretchLifetime");

		playgroundParticlesScriptReference.shurikenParticleSystem = playgroundParticlesScriptReference.GetComponent<ParticleSystem>();
		playgroundParticlesScriptReference.particleSystemRenderer = playgroundParticlesScriptReference.shurikenParticleSystem.renderer;
		particleMaterial = playgroundParticlesScriptReference.particleSystemRenderer.sharedMaterial;
		
		onlySourcePositioning = playgroundParticles.FindProperty("onlySourcePositioning");
		
		applyLifetimeVelocity = playgroundParticles.FindProperty("applyLifetimeVelocity");
		lifeTimeVelocityX = lifetimeVelocity.FindPropertyRelative("x");
		lifeTimeVelocityY = lifetimeVelocity.FindPropertyRelative("y");
		lifeTimeVelocityZ = lifetimeVelocity.FindPropertyRelative("z");
		
		initialVelocityShapeX = initialVelocityShape.FindPropertyRelative("x");
		initialVelocityShapeY = initialVelocityShape.FindPropertyRelative("y");
		initialVelocityShapeZ = initialVelocityShape.FindPropertyRelative("z");
		
		applyInitialVelocity = playgroundParticles.FindProperty("applyInitialVelocity");
		applyInitialLocalVelocity = playgroundParticles.FindProperty("applyInitialLocalVelocity");
		applyVelocityBending = playgroundParticles.FindProperty("applyVelocityBending");
		velocityBendingType = playgroundParticles.FindProperty("velocityBendingType");

		movementCompensationLifetimeStrength = playgroundParticles.FindProperty ("movementCompensationLifetimeStrength");
		
		worldObjectGameObject = worldObject.FindPropertyRelative("gameObject");
		skinnedWorldObjectGameObject = skinnedWorldObject.FindPropertyRelative("gameObject");

		// Lifetime colors
		if (playgroundParticlesScriptReference.lifetimeColors==null)
			playgroundParticlesScriptReference.lifetimeColors = new List<PlaygroundGradientC>();

		// Sorting
		prevLifetimeSortingKeys = playgroundParticlesScriptReference.lifetimeSorting.keys;
		
		// Manipulator list
		manipulatorListFoldout = new List<bool>();
		manipulatorListFoldout.AddRange(new bool[playgroundParticlesScriptReference.manipulators.Count]);

		// Events list
		eventListFoldout = new List<bool>();
		eventListFoldout.AddRange(new bool[playgroundParticlesScriptReference.events.Count]);

		// States foldout
		statesListFoldout = new List<bool>();
		statesListFoldout.AddRange(new bool[playgroundParticlesScriptReference.states.Count]);

		previousSource = playgroundParticlesScriptReference.source;
		
		// Playground
		playgroundScriptReference = FindObjectOfType<PlaygroundC>();
		
		
		// Create a manager if no existing instance is in the scene
		if (!playgroundScriptReference && Selection.activeTransform!=null) {
			PlaygroundC.ResourceInstantiate("Playground Manager");
			playgroundScriptReference = FindObjectOfType<PlaygroundC>();
		}
		
		if (playgroundScriptReference!=null) {
			PlaygroundC.reference = playgroundScriptReference;

			// Serialize Playground
			playground = new SerializedObject(playgroundScriptReference);
			
			PlaygroundInspectorC.Initialize(playgroundScriptReference);
			
			
			// Add this PlaygroundParticles if not existing in Playground list
			if (!playgroundParticlesScriptReference.isSnapshot && !playgroundScriptReference.particleSystems.Contains(playgroundParticlesScriptReference) && Selection.activeTransform!=null)
				playgroundScriptReference.particleSystems.Add(playgroundParticlesScriptReference);
				
			// Cache components
			playgroundParticlesScriptReference.particleSystemGameObject = playgroundParticlesScriptReference.gameObject;
			playgroundParticlesScriptReference.particleSystemTransform = playgroundParticlesScriptReference.transform;
			playgroundParticlesScriptReference.particleSystemRenderer = playgroundParticlesScriptReference.renderer;
			playgroundParticlesScriptReference.shurikenParticleSystem = playgroundParticlesScriptReference.particleSystemGameObject.GetComponent<ParticleSystem>();
			playgroundParticlesScriptReference.particleSystemRenderer2 = playgroundParticlesScriptReference.particleSystemGameObject.particleSystem.renderer as ParticleSystemRenderer;
			
			// Set manager as parent 
			if (PlaygroundC.reference.autoGroup && playgroundParticlesScriptReference.particleSystemTransform!=null && playgroundParticlesScriptReference.particleSystemTransform.parent == null && Selection.activeTransform!=null)
				playgroundParticlesScriptReference.particleSystemTransform.parent = PlaygroundC.referenceTransform;
			
			// Issue a quick refresh
			if (!EditorApplication.isPlaying)
				foreach (PlaygroundParticlesC p in PlaygroundC.reference.particleSystems)
					p.Start();
		}

		selectedSort = sorting.intValue;

		// State initial values
		if (addStateTransform==null)
			addStateTransform = (Transform)playgroundParticlesScriptReference.particleSystemTransform;
		
		// Visiblity of Shuriken component in Inspector
		if (!playgroundScriptReference || playgroundScriptReference && !playgroundScriptReference.showShuriken)
			playgroundParticlesScriptReference.shurikenParticleSystem.hideFlags = HideFlags.HideInInspector;
		else
			playgroundParticlesScriptReference.shurikenParticleSystem.hideFlags = HideFlags.None;

		SetWireframeVisibility();

		// Set paint init
		paintLayerMask = sourcePaint.FindPropertyRelative("layerMask");
		paintCollisionType = sourcePaint.FindPropertyRelative("collisionType");
		
		LoadBrushes();
		
		// Set projection init
		projectionMask = sourceProjection.FindPropertyRelative("projectionMask");
		projectionCollisionType = sourceProjection.FindPropertyRelative("collisionType");

		// Snapshots
		if (playgroundParticlesScriptReference.snapshots.Count>0) {
			if (playgroundParticlesScriptReference.snapshots.Count>0) {
				for (int i = 0; i<playgroundParticlesScriptReference.snapshots.Count; i++)
					if (playgroundParticlesScriptReference.snapshots[i].settings==null)
						playgroundParticlesScriptReference.snapshots.RemoveAt(i);
			}
			saveName += " "+(playgroundParticlesScriptReference.snapshots.Count+1).ToString();
		}
	}
Esempio n. 50
0
 void Start()
 {
     thisPart = GetComponent<PlaygroundParticlesC> ();
     //thatPart = GetComponentInParent<PlaygroundParticlesC> ();
 }
 protected override void OnQuestAdded()
 {
     base.OnQuestAdded();
     playground = GetComponent<PlaygroundParticlesC>();
 }
	// Use this for initialization
	void Start () {
		particles = GetComponent<PlaygroundParticlesC>();
	}
	// Use this for initialization
	void Start () {
		particles = GetComponent<PlaygroundParticlesC>();
		initialOverflow = particles.overflowOffset;
	}
	void Start () {
		particles = GetComponent<PlaygroundParticlesC>();
		thisTransform = transform;
		StartCoroutine(Shoot());
	}
Esempio n. 55
0
 public override void Initialize(EffectSetting effectSetting)
 {
     base.Initialize(effectSetting);
     particleSystem = GetComponent<PlaygroundParticlesC>();
     r_playing = particleSystem.emit;
 }
 protected override void OnAwake()
 {
     base.OnAwake();
     _particles = GetComponent<PlaygroundParticlesC>();
 }
Esempio n. 57
0
	public PlaygroundParticlesC particles;							// The particle system reference

	void Start () {

		// Try to get the PlaygroundParticlesC component from this object if set to null
		if (particles==null)
			particles = GetComponent<PlaygroundParticlesC>();
	}
	void Start () {
		particles = GetComponent<PlaygroundParticlesC>();
		sceneScript = FindObjectOfType<PlaygroundScenes>();
	}
 protected override void OnInitialise()
 {
     base.OnInitialise();
     _playground = GetComponent<PlaygroundParticlesC>();
     r_emit = _playground.emit;
 }
	void Start () {
		// Assume this GameObect is particles is not assigned
		if (particles==null)
			particles = GetComponent<PlaygroundParticlesC>();
	}