コード例 #1
0
        // Autoassign id and UID for a newely created item.
        private void Reset()
        {
            var mapHolder = UnityEngine.Object.FindObjectOfType <MapHolder>();

            id = IdGenerator.AutogenerateNextId <MapSignal>(idPrefix);
            if (string.IsNullOrEmpty(UID))
            {
                UID = Guid.NewGuid().ToString();
            }
        }
コード例 #2
0
ファイル: MapLane.cs プロジェクト: lgsvl/simulator
        // When scene is opened, go over all objects of same type and assign ids if missing.
        static void OnEditorSceneManagerSceneOpened(UnityEngine.SceneManagement.Scene scene, UnityEditor.SceneManagement.OpenSceneMode mode)
        {
            var mapHolder = UnityEngine.Object.FindObjectOfType <MapHolder>();

            if (mapHolder == null)
            {
                return;
            }

            // If there is no ID set, set autogenerated ones.
            foreach (var sign in mapHolder.transform.GetComponentsInChildren <MapLane>())
            {
                if (string.IsNullOrEmpty(sign.id))
                {
                    sign.id = IdGenerator.AutogenerateNextId <MapLane>(idPrefix);
                }
            }
        }
コード例 #3
0
ファイル: MapLane.cs プロジェクト: lgsvl/simulator
        // Autoassign id for a newely created item.
        private void Reset()
        {
            var mapHolder = UnityEngine.Object.FindObjectOfType <MapHolder>();

            id = IdGenerator.AutogenerateNextId <MapLane>(idPrefix);
        }