Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        GameObject temp = gameObject.transform.parent.gameObject;

        crossing       = temp.transform.parent.gameObject;
        scriptCrossing = (CrossingT)crossing.GetComponent(typeof(CrossingT));
        scriptCrossing.setCollider(gameObject.name, this);

        trafficLight = gameObject.GetComponentInChildren <Light>();

        if (!isControlled)
        {
            Destroy(getChildGameObject(gameObject, "TrafficLight"));
            Destroy(getChildGameObject(gameObject, "Spotlight"));
        }
    }
Exemplo n.º 2
0
    public List <Waypoint> GetWayPoints()
    {
        Straight  _straight  = straight.GetComponent <Straight>();
        Crossing  _crossing  = crossing.GetComponent <Crossing>();
        CrossingT _crossingT = crossingT.GetComponent <CrossingT>();
        Turn      _turn      = turn.GetComponent <Turn>();

        switch (roadType)
        {
        case TYPE.Straight:
            return(new List <Waypoint>
            {
                _straight.topIn, _straight.topOut, null, null, _straight.bottomIn, _straight.bottomOut, null, null
            });

        case TYPE.Turn:
            return(new List <Waypoint>
            {
                _turn.topIn, _turn.topOut, null, null, null, null, _turn.leftIn, _turn.leftOut
            });

        case TYPE.CrossingT:
            return(new List <Waypoint>
            {
                _crossingT.topIn, _crossingT.topOut, null, null,
                _crossingT.bottomIn, _crossingT.bottomOut, _crossingT.leftIn, _crossingT.leftOut
            });

        case TYPE.Crossing:
            return(new List <Waypoint>
            {
                _crossing.topIn, _crossing.topOut, _crossing.rightIn, _crossing.rightOut,
                _crossing.bottomIn, _crossing.bottomOut, _crossing.leftIn, _crossing.leftOut
            });
        }
        return(new List <Waypoint>());
    }