예제 #1
0
    public bool addTrain(GameObject NodeToSpawnAt, bool direction)
    {
        //I wonder if a train factory would make sense, pass it in here.
        //for now we can handle making trains in the transport
        GameObject      train      = Instantiate(TrainPrefab, NodeToSpawnAt.transform.position, Quaternion.identity, m_trainsContainerTransform);
        TrainController controller = train.GetComponent <TrainController>();

        controller.setDirection(direction);
        controller.setParentLine(this);
        controller.setCurrentNode(NodeToSpawnAt);
        m_trains.Add(train);

        return(true);
    }