예제 #1
0
    public IEnumerator Fly(UnitFlight flier, Vector3 destination)
    {
        if (flier.GetComponent <UnitScript>() != null)
        {
            SetTileAndUnitPair(flier.GetComponent <UnitScript>(), destination);
        }
        flier.CanMove  = false;
        flier.isMoving = true;
        flier.GoUp();
        while (Mathf.Abs(flier.transform.position.y - flier.FLIGHT_HEIGHT) > flier.GetSmoothDistance())
        {
            yield return(null);
        }
        flier.FlyTowards(destination);
        while (Vector3.Distance(flier.transform.position, flier.GetDestination()) > flier.GetSmoothDistance())
        {
            yield return(null);
        }

        flier.GoDown(destination);
        while (flier.transform.position.y > flier.GetSmoothDistance())
        {
            yield return(null);
        }
        PathCreator.Instance.Path.Clear();
        FinishMovement(flier);
    }
예제 #2
0
 // Use this for initialization
 void Start()
 {
     boxbox = this.gameObject.GetComponent <Collider>();
     possibleDestinations = new List <Tile>();
     thisUnit             = this.transform.root.GetComponent <UnitFlight>();
 }