public void OnEnable () 
	{
		trails = target as PlaygroundTrails;
		s_trails = new SerializedObject(trails);

		s_time = s_trails.FindProperty("time");

		s_material = s_trails.FindProperty("material");
		s_lifetimeColor = s_trails.FindProperty("lifetimeColor");
		s_colorMode = s_trails.FindProperty("colorMode");
		s_uvMode = s_trails.FindProperty("uvMode");
		s_pointArrayAlpha = s_trails.FindProperty("pointArrayAlpha");
		s_renderMode = s_trails.FindProperty("renderMode");
		s_billboardTransform = s_trails.FindProperty("billboardTransform");
		s_customRenderScale = s_trails.FindProperty("customRenderScale");

		s_timeWidth = s_trails.FindProperty("timeWidth");
		s_widthScale = s_trails.FindProperty("widthScale");

		s_minVertexDistance = s_trails.FindProperty("minVertexDistance");
		s_maxVertexDistance = s_trails.FindProperty("maxVertexDistance");
		s_maxPathDeviation = s_trails.FindProperty("maxPathDeviation");
		s_createPointsOnCollision = s_trails.FindProperty("createPointsOnCollision");
		s_maxPoints = s_trails.FindProperty("maxPoints");
		s_createFirstPointOnParticleBirth = s_trails.FindProperty("createFirstPointOnParticleBirth");
		s_createLastPointOnParticleDeath = s_trails.FindProperty("createLastPointOnParticleDeath");

		s_playgroundSystem = s_trails.FindProperty("playgroundSystem");
		s_multithreading = s_trails.FindProperty("multithreading");

		s_receiveShadows = s_trails.FindProperty("receiveShadows");
#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6
		s_castShadows = s_trails.FindProperty("castShadows");
#else
		s_castShadows = s_trails.FindProperty("shadowCastingMode");
#endif
		playgroundSettings = PlaygroundSettingsC.GetReference();
		playgroundLanguage = PlaygroundSettingsC.GetLanguage();

		// Issue a quick refresh
		if (!EditorApplication.isPlaying && Selection.activeTransform!=null)
		{
			trails.ResetTrails();
		}
	}
Example #2
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());
                
            }
        }
    }