コード例 #1
0
    IEnumerator GetToDestination(float height, ShaftDoors shaftDoors)
    {
        Vector3 desiredPosition = new Vector3(transform.position.x, height, transform.position.z);

        while (Vector3.Distance(transform.position, desiredPosition) > 0.10f)
        {
            transform.position = Vector3.MoveTowards(transform.position, desiredPosition, elevatorSpeed * Time.deltaTime);
            yield return(null);
        }
        GameController.instance.SetFloor((int)destinationFloorNumber);
        currentFloorNumber = destinationFloorNumber;
    }
コード例 #2
0
    IEnumerator CallElevatorCoroutine(uint floor, float height, ShaftDoors shaftDoors)
    {
        //wait for doors to close on the current floor
        yield return(StartCoroutine(ClosePreviousElevatorDoors()));

        destinationFloorNumber = floor;
        //if elevator is already on the current floor, just open the doors
        if (currentFloorNumber == floor)
        {
            Debug.Log("Elevator is on the current floor. Opening doors!");
            shaftDoors.Open();
        }
        else
        {
            //wait for elevator to arrive
            yield return(StartCoroutine(GetToDestination(height, shaftDoors)));

            shaftDoors.Open();
        }

        Debug.Log("Please Enter");
    }
コード例 #3
0
ファイル: ElevatorButton.cs プロジェクト: jmencfel/Red
 public void SetValues(uint f, float h, ShaftDoors d)
 {
     floor  = f;
     height = h;
     door   = d;
 }
コード例 #4
0
 private void CallElevator(uint floor, float height, ShaftDoors shaftDoors)
 {
     StartCoroutine(CallElevatorCoroutine(floor, height, shaftDoors));
 }