예제 #1
0
    // fly as long the plane reached the stop or landing field it stops the MoveToNextField coroutine
    private IEnumerator StopAtField(Vector3 newPos)
    {
        if (landing)
        {
            landingAnim.SetTrigger("Land");
        }
        while (Fly(newPos))
        {
            yield return(null);
        }
        moveFBAnim.enabled = false;

        if (landing)
        {
            planeMesh.transform.position = new Vector3(planeMesh.transform.position.x, planeMesh.transform.position.y - (landingSpeed * Time.deltaTime), planeMesh.transform.position.z);
            planeMan.PlaneLanded(this, fieldsMovement);
            Destroy(movementFeedback.gameObject);
            Destroy(groundMarker.gameObject);
            yield return(new WaitForSeconds(0.5f));

            Destroy(gameObject);
        }
        else
        {
            notInteractable = false;
            movementFeedback.transform.position = planeTransform.position;
            moveFBAnim.enabled = true;
            moveFBAnim.SetTrigger("Reset");
        }
    }