Ejemplo n.º 1
0
    // Update is called once per frame
    public virtual void DoSpawnAndParent()
    {
        FlightPath fp = GameObject.Instantiate(flightPathToSpawn) as FlightPath;

        fp.transform.parent   = transform;
        fp.transform.position = routes[0].pathNodes[0].position;
        fp.transform.rotation = routes[0].pathNodes[0].rotation;
        foreach (FlightRoute route in routes)
        {
            route.targetGameObject = fp.gameObject;
        }
        FlightPathTrigger[] triggers = gameObject.GetComponentsInChildren <FlightPathTrigger>();
        foreach (FlightPathTrigger fpt in triggers)
        {
            fpt.targetFlightPath = fp;
        }
        fp.routes = routes;
        fp.Initialize();
    }