Exemplo n.º 1
0
    bool CheckCollisionForRay(Ray ray, float distance)
    {
        bool re = false;

        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, distance))
        {
            ParticleSystemSpawner particleSystemSpawner = hit.transform.gameObject.GetComponent <ParticleSystemSpawner>();

            if (particleSystemSpawner != null)
            {
                re = false;
            }
            else
            {
                re = true;
            }


            hittedNormal = hit.normal;

            hittedPosition = hit.point;

            hittedGameObject = hit.transform.gameObject;
        }

        return(re);
    }
Exemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        ParticleSystemSpawner myTarget = (ParticleSystemSpawner)target;


        labelGuiStyle = new GUIStyle();

        labelGuiStyle.fontStyle = FontStyle.Bold;


        /////////////////
        EditorGUI.BeginChangeCheck();

        myTarget.particleSystemToSpawn = EditorGUILayout.ObjectField("Particle System To Spawn",
                                                                     myTarget.particleSystemToSpawn, typeof(GameObject), false) as GameObject;

        EditorGUILayout.HelpBox(
            "'Choosen Particle System To Spawn' accept only project prefabs. " +
            "After modifying this field " +
            "click on the 'Apply' button (if it exist at the top right of this inspector), " +
            "otherwise the change is not reflercted in play mode.", MessageType.Info, true);


        if (myTarget.particleSystemToSpawn != null)
        {
            myTarget.gameObject.name = "Pss_" + myTarget.particleSystemToSpawn.gameObject.name;
        }


        EditorGUILayout.PropertyField(serializedObject.FindProperty("isTouchDevice"), false);

        if (!myTarget.isTouchDevice)
        {
            EditorGUILayout.PropertyField(serializedObject.FindProperty("keyInputToSpawn"), false);
        }
        else
        {
            EditorGUILayout.PropertyField(serializedObject.FindProperty("spawnByTouchingMe"), false);

            if (!myTarget.spawnByTouchingMe)
            {
                EditorGUILayout.HelpBox(
                    "If you choose 'false' for 'Spawn By Touching Me', " +
                    "you will need to call the public function: " +
                    "'ParticleSystemSpawner.SpawnThat(GameObject go)' " +
                    "Somewhere in your code", MessageType.Info, true);
            }
        }


        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
        }
    }
Exemplo n.º 3
0
    public void LightALightWithDelay()
    {
        DoorLight light = FindUnqueuedToBeLitLight();

        if (light != null)
        {
            light.SetLitWithDelay(ParticleSystemSpawner.GetInstance().GetPrototype().GetParticleLifeTime() - m_lightPreLightupTime);
        }
    }
Exemplo n.º 4
0
    bool CheckCollisionForRay(Ray ray, float distance)
    {
        bool re = false;

        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, distance) && hit.collider.tag != gameObject.tag)
        {
            ParticleSystemSpawner particleSystemSpawner = hit.transform.gameObject.GetComponent <ParticleSystemSpawner>();

            if (particleSystemSpawner != null)
            {
                re = false;
            }
            else
            {
                re = true;
            }


            hittedNormal = hit.normal;

            hittedPosition = hit.point;

            hittedGameObject = hit.transform.gameObject;

            Player p = hittedGameObject.GetComponent <Player>();
            if (p)
            {
                p.UpdateHealth(p.HealthPoint - p.hitDamage);
            }
            Enemy e = hittedGameObject.GetComponent <Enemy>();
            if (e)
            {
                e.UpdateHealth(e.healthPoint - 20f);
            }
        }

        return(re);
    }
Exemplo n.º 5
0
    void PopulateParticleSystemSpawners()
    {
        particleSystemSpawners = GetComponentsInChildren <ParticleSystemSpawner> (false);

        for (int i = 0; i < particleSystemSpawners.Length; i++)
        {
            particleSystemSpawners [i].gameObject.SetActive(false);
        }

        readyParticleSystemSpawners = particleSystemSpawners [readyId];

        readyParticleSystemSpawners.gameObject.SetActive(true);

        /////

        /*if(isDemo)
         * {
         *      readyParticleSystemSpawners.SpawnThat (readyParticleSystemSpawners.particleSystemToSpawn);
         *
         *      /////
         *      uiActiveParticleSystemName.text = readyParticleSystemSpawners.particleSystemToSpawn.name;
         * }*/
    }
Exemplo n.º 6
0
    void UpdateReadyParticleSystemSpawners()
    {
        float mouseWheel = Input.GetAxis("Mouse ScrollWheel");


        float upDownArrows = 0f;

        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            upDownArrows = 1f;
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            upDownArrows = -1f;
        }



        float inp = 0f;

        switch (inputToChangeBetweenParticleSystems)
        {
        case InputToChangeBetweenParticleSystems.upDownArrows:
            inp = upDownArrows;
            break;

        case InputToChangeBetweenParticleSystems.mouseScrollWheel:
            inp = mouseWheel;
            break;

        case InputToChangeBetweenParticleSystems.gui:
            inp = guiInput;
            break;
        }


        /////

        /*if(isDemo)
         * {
         *      if (Frequence (2.1f))
         *              inp = -1f;
         * }*/


        if (inp == 0f)
        {
            return;
        }

        if (inp < 0f)
        {
            AugmentReadyId();
        }
        else if (inp > 0f)
        {
            DiminishReadyId();
        }

        readyParticleSystemSpawners.gameObject.SetActive(false);

        readyParticleSystemSpawners = particleSystemSpawners [readyId];

        readyParticleSystemSpawners.gameObject.SetActive(true);

        /////

        /*if(isDemo)
         * {
         *      readyParticleSystemSpawners.SpawnThat (readyParticleSystemSpawners.particleSystemToSpawn);
         *
         *      /////
         *      uiActiveParticleSystemName.text = readyParticleSystemSpawners.particleSystemToSpawn.name;
         * }*/
    }
Exemplo n.º 7
0
    public void AddScoreWithDelay(int scoreToAdd)
    {
        float delay = ParticleSystemSpawner.GetInstance().GetPrototype().GetParticleLifeTime() - m_scorePreWarm;

        StartCoroutine(ScoreWithDelay(delay, scoreToAdd));
    }