Beispiel #1
0
    void OnDestroy()
    {
        s_Instance = null;
        m_DataSource.Destroy();

        RSTile.OnTileCreate  -= OnTileCreate;
        RSTile.OnTileDestroy -= OnTileDestroy;
    }
Beispiel #2
0
    private void OnEnable()
    {
        roadSystem = (RoadSystem)target;

        if (roadSystem.settings == null)
        {
            roadSystem.settings = RoadCreatorSettings.GetSerializedSettings();
        }

        lastTool      = Tools.current;
        Tools.current = Tool.None;
    }
Beispiel #3
0
    void Start()
    {
        workPlane  = new Plane(Vector3.up, Vector3.zero);
        roadSystem = new RoadSystem();

        tool                 = new DrawRoad(roadSystem);
        stat                 = Stat.road;
        tool.workPlane       = workPlane;
        Tool.onToolComplete += GetInfo;

        bt_polyline.onClick.AddListener(drawPolyline);
        bt_polygon.onClick.AddListener(drawPolygon);
        bt_road.onClick.AddListener(drawRoad);
    }
Beispiel #4
0
    private void OnEnable()
    {
        roadSystem = (RoadSystem)target;

        if (GameObject.FindObjectOfType <GlobalSettings>() == null)
        {
            new GameObject("Global Settings").AddComponent <GlobalSettings>();
        }

        if (roadSystem.globalSettings == null)
        {
            roadSystem.globalSettings = GameObject.FindObjectOfType <GlobalSettings>();
        }

        lastTool      = Tools.current;
        Tools.current = Tool.None;
    }
Beispiel #5
0
    // Use this for initialization
    void Awake()
    {
        s_Instance   = this;
        m_DataSource = new RSDataSource();
        m_Renderers  = new Dictionary <int, RSTileRenderer> ();

        int rccnt = RSTile.CELL_AXIS_COUNT * RSTile.CELL_AXIS_COUNT;

        RSTileRenderer.EmptyTexture       = new Color32[rccnt];
        RSTileRenderer.EmptyHeightTexture = new Color32[rccnt];
        for (int i = 0; i < rccnt; ++i)
        {
            RSTileRenderer.EmptyTexture[i]       = new Color32(0, 0, 0, 0);
            RSTileRenderer.EmptyHeightTexture[i] = new Color32(0, 0, 0, 255);
        }

        RSTile.OnTileCreate  += OnTileCreate;
        RSTile.OnTileDestroy += OnTileDestroy;
    }
        public void TestContainsNode()
        {
            RoadSystem anotherSystem = new RoadSystem();
            var anotherNode = anotherSystem.CreateNewNode(2);
            var newNode = _roadSystem.CreateNewNode(1);

            Assert.IsFalse(_roadSystem.Contains(anotherNode));
            Assert.IsTrue(_roadSystem.Contains(newNode));
        }
 public void TearDownTest()
 {
     _roadSystem = null;
     GC.Collect();
     GC.WaitForPendingFinalizers();
 }
 public void SetUpTest()
 {
     _roadSystem = new RoadSystem();
 }
        public void TestLink_NodesNotInSameSystem()
        {
            var anotherSystem = new RoadSystem();
            var anotherNode = anotherSystem.CreateNewNode(2);
            var node = _roadSystem.CreateNewNode(1);

            _roadSystem.Link(node, anotherNode, 1);
        }