Пример #1
0
    private void OnTriggerExit(Collider other)
    {
        GameObject o = other.gameObject;

        if (o.name == "GoalCollider")
        {
            colstate = ColState.None;
        }
    }
Пример #2
0
    private void OnTriggerEnter(Collider other)
    {
        Debug.Log(other.name);
        Debug.Log(colstate);
        // goal
        GameObject o = other.gameObject;

        if (o.name == "FrontBox" && colstate == ColState.None)
        {
            colstate = ColState.Front;
        }
        if (o.name == "BackBox" && colstate == ColState.None)
        {
            colstate = ColState.Back;
        }
        if (o.name == "BackBox" && colstate == ColState.Front)
        {
            GameObject.Find("dix points").GetComponent <AudioSource>().Play();
            GameObject.Find("ding").GetComponent <AudioSource>().Play();
            GameObject.Find("barca").GetComponent <AudioSource>().Play();
            colstate = ColState.None;
        }
    }