예제 #1
0
    void FixedUpdate()
    {
        if (GamePlayController.isGameEnded)
        {
            return;
        }
        switch (currentState)
        {
        case PoliceCarState.OnRoad:
            CarOnRoad();
            break;

        case PoliceCarState.OnFly:

            currentState = PoliceCarState.OnAirWait;
            break;

        case PoliceCarState.OnAirWait:
            GetComponent <Rigidbody>().position = new Vector3(lanePosition, carJump_Height, GetComponent <Rigidbody>().position.z);
            break;

        case PoliceCarState.idle:
            break;
        }
    }
예제 #2
0
    void OnEnable()
    {
        PoliceCar_Back();
        thisTrans = transform;         // coping the game object transform values in to a local value

        playercarScript = GameObject.FindGameObjectWithTag("Player").GetComponent <playerCarControl> ();

        currentState = PoliceCarState.OnRoad;              // to start police car state on road

        currentMode = PoliceCarMode.Avoid;                 // to start police car with avid Mode

        PoliceCar_Back();                                  //

        InvokeRepeating("PoliceCarMode_Change", 10f, 20f); // police car mode changing here

        policeCarSound.volume = 0.3f;
    }