示例#1
0
    void Update()
    {
        timeLeftPlat.text = totalTime.ToString();
        statusPlat.text   = currentState.ToString();


        if (currentState == driverState.driving)
        {
            busy.SetActive(true);
            foreach (GameObject obj in disable)
            {
                obj.SetActive(false);
            }
        }

        if (currentState == driverState.waiting)
        {
            busy.SetActive(false);
            foreach (GameObject obj in disable)
            {
                obj.SetActive(true);
            }
        }

        // Time Managment
        if (time >= totalTime)
        {
            currentState = driverState.waiting;
            time         = 0;
        }
        else
        {
            time += Time.deltaTime;
        }
    }
示例#2
0
    public void order()
    {
        if (currentState == driverState.waiting)
        {
            if (passangerData.passangerName != "" && passangerData.id.ToString() != "" && passangerData.location != "")
            {
                if (passengerName.text == passangerData.passangerName && PassengerID.text == passangerData.id.ToString() && PassengerLocation.text == passangerData.location)
                {
                    if (passangerData.emergency > 5)
                    {
                        repu.reputation += 1;
                    }

                    source.PlayOneShot(clip);

                    money.money                += passangerData.money;
                    passengerName.text          = "";
                    PassengerID.text            = "";
                    PassengerLocation.text      = "";
                    passangerData.passangerName = "";
                    passangerData.id            = 0;
                    passangerData.location      = "";

                    passangerData.dataStored = false;
                    currentState             = driverState.driving;
                    totalTime = passangerData.time + driverSpeed;
                    time      = 0;
                }
            }
        }
    }
示例#3
0
 void Start()
 {
     repu          = GameObject.FindGameObjectWithTag("GameManager").GetComponent <Reputation>();
     money         = GameObject.FindGameObjectWithTag("GameManager").GetComponent <MoneyCounter>();
     passangerData = GameObject.FindGameObjectWithTag("Notepad").GetComponent <StorePassangerData>();
     currentState  = driverState.waiting;
 }