예제 #1
0
    private void PlayDeBoardTaxiAnimation2()
    {
        //float fltWaving = 0;
        //float fltWalking = 1.0f;

        fltWaving = 0;

        //please remain seated until we have come to a full stop!  :)
        //if the taxi is still moving, dont start the deboard animation
        //also, keep track of if the animation has started.  if the taxi takes off again, we want to
        //complete the animation
        if (scrTaxiDriver.Instance.location == clsGameConstants.enLocations.InTransit && stateManager.PlayingUnboardAnimation == false) return;

        //once the taxi has landed, start the animation
        stateManager.PlayingUnboardAnimation = true;

        //move the passenger location to the taxi location
        location = scrTaxiDriver.Instance.location;

        //find out where on the pad we should walk to
        Vector3 PassengerWalkToLocation = GetPadsBestPassengerLocation(location.ToString(), scrTaxiDriver.Instance.transform.position);

        if (stateManager.InitUnboardAnimation == false)
        {
            stateManager.InitUnboardAnimation = true;
            //place the passenger next to the door closest to the walk to point
            gameObject.transform.position = scrTaxiDriver.Instance.transform.position - Vector3.up * 0.75f;
            //make the passenger visible so he looks like he got out of the cab
            clsHelper.SetObjectVisiblity(true, gameObject);
        }

        //see how far away we are from the door
        float fltDistToWalkToLocation = (PassengerWalkToLocation - gameObject.transform.position).magnitude;

        if (fltDistToWalkToLocation > 0.5)
        {
            //if we are more than half a unit from there, then keep walking
            //point the passenger at the walkto location
            gameObject.transform.LookAt(PassengerWalkToLocation);
            fltWalking = 1;
        }
        else
        {
            //we have arrived at the walk to point
            //make the passenger invisible so he appears to have gotten in the building
            fltWalking = 0;
            gameObject.transform.LookAt(new Vector3(PassengerWalkToLocation.x, transform.position.y, PassengerWalkToLocation.z));
            clsHelper.SetObjectVisiblity(false, gameObject);
            stateManager.SetState(clsPassengerStateManager.enState.Leaving);
        }

        //send variables to the animation controller
        anim.SetFloat("walking", fltWalking);
        anim.SetFloat("waving", fltWaving);
    }
예제 #2
0
    /// <summary>
    /// 
    /// </summary>
    public void PlayDeBoardTaxiAnimation()
    {
        //please remain seated until we have come to a full stop!  :)
        //if the taxi is still moving, dont start the deboard animation
        //also, keep track of if the animation has started.  if the taxi takes off again, we want to
        //complete the animation
        if (scrTaxiDriver.Instance.location == clsGameConstants.enLocations.InTransit && stateManager.PlayingUnboardAnimation == false) return;

        //once the taxi has landed, start the animation
        stateManager.PlayingUnboardAnimation = true;

        //move the passenger location to the taxi location
        location = scrTaxiDriver.Instance.location;
        //find out from the pad where the passenger should walk to
        Vector3 PassengerWalkToLocation = GetPadsBestPassengerLocation(location.ToString(), scrTaxiDriver.Instance.transform.position);

        if (stateManager.InitUnboardAnimation == false)
        {
            stateManager.InitUnboardAnimation = true;
            //figure out which door is closest
            float fltDistToLeftDoor = (scrTaxiDriver.Instance.LeftDoor.transform.position - PassengerWalkToLocation).magnitude;
            float fltDistToRightDoor = (scrTaxiDriver.Instance.RightDoor.transform.position - PassengerWalkToLocation).magnitude;
            //default to the left door
            Vector3 vctDoorPosition = scrTaxiDriver.Instance.LeftDoor.transform.position;
            //if the right door is closer, use it
            if (fltDistToRightDoor < fltDistToLeftDoor) vctDoorPosition = scrTaxiDriver.Instance.RightDoor.transform.position;
            //place the passenger next to the door closest to the walk to point
            gameObject.transform.position = vctDoorPosition;
            //make the passenger visible so he looks like he got out of the cab
            clsHelper.SetObjectVisiblity(true, gameObject);

        }
        //see how far away we are from the door
        float fltDistToWalkToLocation = (PassengerWalkToLocation - gameObject.transform.position).magnitude;

        if (fltDistToWalkToLocation > 0.5)
        {
            //if we are more than half a unit from there, then keep walking
            gameObject.transform.position = Vector3.Lerp(gameObject.transform.position, PassengerWalkToLocation, Time.deltaTime * 0.7f);
        }
        else
        {
            //we have arrived at the walk to point
            //make the passenger invisible so he appears to have gotten in the building
            clsHelper.SetObjectVisiblity(false, gameObject);
            stateManager.SetState(clsPassengerStateManager.enState.Leaving);
        }
    }