Example #1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.name == "PlayerCol1")
        {
            mdiEsc = true;

            other.GetComponentInParent <AudioSource>().Play();
            other.GetComponentInParent <Rigidbody>().AddTorque(Vector3.up * 160f);

            GOIS();
        }

        if (other.name == "PlayerCol2")
        {
            Quaternion r = Quaternion.Euler(new Vector3(60f, -90f, 0f));
            Vector3    p = transform.position + r * Vector3.back * 1.5f;

            same = (DemoShark)Instantiate(sameAsset, p, r);

            same.kajiki = transform;

            GOIS();
        }

        if (other.tag == "DemoSame")
        {
            rb.isKinematic = true;

            transform.parent = other.transform;

            same.EatKajiki();

            StartCoroutine(dm.SameEating());

            GOIS();
        }
    }