コード例 #1
0
    void OnTriggerExit(Collider col)
    {
        if (col.tag != "ParkingSpace")
        {
            return;
        }

        if (carParkController == null)
        {
            carParkController = GameObject.FindObjectOfType <CarParkController>();
        }

        ParkingSpace ps = carParkController.GetParkingSpace(col.gameObject);

        if (ps.occupied == true)
        {
            return;
        }

        carParkController.ToggleParkingSpaceIndicator(ps, false);
    }
コード例 #2
0
    void OnTriggerStay(Collider col)
    {
        if (col.tag != "ParkingSpace")
        {
            return;
        }

        if (carParkController == null)
        {
            carParkController = GameObject.FindObjectOfType <CarParkController>();
        }

        ParkingSpace ps = carParkController.GetParkingSpace(col.gameObject);

        if (ps.occupied == true)
        {
            return;
        }

        carParkController.ToggleParkingSpaceIndicator(ps, true);
        WorldController.Instance.world.ParkCar(ps);
    }