Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (rocket_time < pause_time)
        {
            sushi_body.MoveRotation(transform.localRotation * Quaternion.AngleAxis(Mathf.Sin(Time.time * shake_speed) * shake_intensity, transform.up));
            //sushi_body.MovePosition(transform.position + transform.right * Mathf.Sin(Time.time * shake_speed) * shake_intensity);
            shake_intensity += shake_intensity * Time.deltaTime;
        }

        if (rocket_time > pause_time)
        {
            rocket_trail.SetActive(true);
            rocket_sparks.SetActive(false);
            foreach (GameObject child in glows)
            {
                child.SetActive(true);
            }
            speed += Time.deltaTime * acceleration_rate;
            sushi_body.velocity += -transform.forward * acceleration_rate;
        }

        if (rocket_time > max_rocket_time)
        {
            Instantiate(explosion, transform.position, transform.rotation);
            saver.RemoveSushi(this.gameObject);
            Destroy(this.gameObject);
        }

        rocket_time += Time.deltaTime;
    }
Esempio n. 2
0
    private void OnTriggerEnter(Collider other)
    {
        GameObject go = other.gameObject;

        if (go.GetComponent <Savable>())
        {
            if (go.name.Contains("Sauce"))
            {
                saver.RemoveSauce(go);
            }
            else
            {
                saver.RemoveSushi(go);
            }
        }

        if (go.transform.parent)
        {
            if (go.transform.parent.gameObject.GetComponent <Savable>())
            {
                if (go.name.Contains("Sauce"))
                {
                    saver.RemoveSauce(go.transform.parent.gameObject);
                }
                else
                {
                    saver.RemoveSushi(go.transform.parent.gameObject);
                }
            }
        }

        if (go.GetComponent <Grabbable>())
        {
            Destroy(go, cleanUptime);
        }
        else if (go.transform.parent)
        {
            if (go.transform.parent.gameObject.GetComponent <Grabbable>())
            {
                Destroy(go.transform.parent.gameObject, cleanUptime);
            }
        }
    }
Esempio n. 3
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.transform.parent != null)
        {
            colliding_object = other.gameObject.transform.parent.gameObject;
        }
        else
        {
            colliding_object = other.gameObject;
        }


        if (colliding_object.GetComponent <Grabbable>() != null)
        {
            string ishot = colliding_object.tag;
            colliding_object.GetComponent <Grabbable>().GrabEnd(true);

            if (colliding_object.AddComponent <Savable>())
            {
                if (colliding_object.name.Contains("Sauce"))
                {
                    saver.RemoveSauce(colliding_object);
                }
                else
                {
                    saver.RemoveSushi(colliding_object);
                }
            }

            Destroy(colliding_object);
            Debug.Log("Fish ate!");

            if (SceneManager.GetActiveScene().name.Contains("Godzilla"))
            {
                eat_pop.pitch = Random.Range(1f, 1.3f);
            }
            else
            {
                eat_pop.pitch = Random.Range(1f, 2f);
            }

            eat_pop.Play();


            string sauce_type = "";

            if (colliding_object.GetComponent <Saucable>())
            {
                sauce_type = colliding_object.GetComponent <Saucable>().sauce_type;
            }

            switch (sauce_type)
            {
            case "HotSauce":
                GameObject.Find("SceneDirector").GetComponent <SceneDirector>().SetHot();
                break;

            case "XenoSauce":
                GameObject.Find("SceneDirector").GetComponent <SceneDirector>().SetXeno();
                break;

            case "TronSauce":
                GameObject.Find("SceneDirector").GetComponent <SceneDirector>().SetTron();
                break;

            case "TargetSauce":
                if (!DuckHuntDirector.GetComponent <DuckHunt>().isGameRunning())
                {
                    DuckHuntDirector.GetComponent <DuckHunt>().InitiateGame();
                }
                break;

            /*case "TrekSauce":
             *  GameObject.Find("SceneDirector").GetComponent<SceneDirector>().SetTrek();
             *  break;*/

            default:
                if (!showing_nom)
                {
                    ShowOmNom();
                }
                break;
            }
        }
    }