Exemple #1
0
    /*  private void Update()
     * {
     *    Debug.Log("Stop active:" + stopSignActive);
     * }*/

    private void OnTriggerEnter(Collider other)
    {
        //Debug.Log(transform.name + " var: " + var.ToString());
        if (transform.name == "ColliderFirst")
        {
            var.x.flag1 = true;
            var.x.isWrongWay();
        }
        if (transform.name == "ColliderSecond")
        {
            var.x.flag2 = true;
            var.x.isWrongWay();
        }

        if (transform.name == "ColliderStop")
        {
            StopSign.stopSignActive = true;
            Debug.Log("Usao u stop");
            Instance.stop.CheckStop(transform);
            //Timer(3);
        }

        if (transform.name == "ColliderUp")
        {
            UP.isActive = true;
            Debug.Log("Usao u UP");
        }

        if (transform.name == "ColliderLeft&Up")
        {
            LeftUp.isActive = true;
            Debug.Log("Usao u Left&UP");
        }

        if (transform.name == "ColliderLeft")
        {
            LeftSign.isActive = true;
            Debug.Log("Left");
        }

        if (transform.name == "ColliderRight")
        {
            RightSign.isActive = true;
            Debug.Log("Right");
        }

        if (transform.name == "ColliderRight&Up")
        {
            RightUp.isActive = true;
            Debug.Log("RightUP");
        }

        if (transform.name == "ColliderBoth")
        {
            LeftRight.isActive = true;
            Debug.Log("Left & Right");
        }

        if (transform.name == "ColliderWrongWay")
        {
            Debug.Log("Krivi smjer!");
        }

        if (transform.GetComponentInParent <IntersectionWrongWay>() != null)
        {
            // intersection = transform.GetComponentInParent<IntersectionWrongWay>();
            if (UP.isActive)
            {
                UP.check(transform);
            }
            else if (LeftUp.isActive)
            {
                LeftUp.isWrongWay(transform);
            }
            else if (LeftSign.isActive)
            {
                LeftSign.isWrongWay(transform);
            }
            else if (RightSign.isActive)
            {
                RightSign.checkIsRight(transform);
            }
            else if (RightUp.isActive)
            {
                RightUp.checkIsRight(transform);
            }
            else if (LeftRight.isActive)
            {
                LeftRight.isWrongWay(transform);
            }
            else
            {
                //Debug.Log("nop");
                IntersectionRules.isWrongWay(transform);
            }
        }
    }