Пример #1
0
    public void DetachEastNeighbor()
    {
        RoadData detached = eastNeighboringRoad;

        eastNeighboringRoad = null;

        if (detached.westNeighboringRoad != null)
        {
            detached.DetachWestNeighbor();
            detached.AdaptToNeighborhood();
        }
    }
Пример #2
0
    public void DetachNorthNeighbor()
    {
        RoadData detached = northNeighboringRoad;

        northNeighboringRoad = null;

        if (detached.southNeighboringRoad != null)
        {
            detached.DetachSouthNeighbor();
            detached.AdaptToNeighborhood();
        }
    }
Пример #3
0
    /**
     * Cette fonction est appelée par le PlacementListener associé à la route
     * si celui-ci lui découvre un voisin au sud.
     **/
    public void southNeighborDetected(GameObject neighbor) //Lié via l'inspecteur au PlacementListener
    {
        RoadData neighborData = neighbor.GetComponent <RoadData>();

        if (neighborData != null)
        {
            southNeighboringRoad = neighborData;

            if (southNeighboringRoad.northNeighboringRoad == null)
            {
                southNeighboringRoad.northNeighborDetected(gameObject);
                southNeighboringRoad.AdaptToNeighborhood();
            }
        }
    }