コード例 #1
0
        private void OnPlayModeStateChanged(PlayModeStateChange state)
        {
            switch (state)
            {
            case PlayModeStateChange.EnteredPlayMode:
                if (FindObjectOfType <EasyWorldBuilder>() == null)
                {
                    runtimeEditor = new GameObject().AddComponent <EasyWorldBuilder>();
                    runtimeEditor.gameObject.name = "WorldBuilder Runtime Editor";
                    runtimeEditor.hideFlags       = HideFlags.HideInHierarchy;
                }

                runtimeEditor.Settings = settings;
                runtimeEditor.SpawnController(placementMode);
                break;

            case PlayModeStateChange.ExitingPlayMode:
                //Save Assets on playmode exit
                runtimeEditor.SaveSys.SavePlacedAssets();

                if (FindObjectOfType <EasyWorldBuilder>() != null)
                {
                    Destroy(runtimeEditor.gameObject);
                }
                break;

            case PlayModeStateChange.EnteredEditMode:
                //Load Assets on editmode enter
                new LoadFromFile().LoadData();
                break;
            }
        }
コード例 #2
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
コード例 #3
0
ファイル: RuntimeUI.cs プロジェクト: aaronvark/PeerReview1819
        private void Start()
        {
            mgr = FindObjectOfType <EasyWorldBuilder>();

            scrollBar = GetComponentInChildren <VerticalLayoutGroup>();

            //Draw initial UI buttons.
            for (int i = 0; i < mgr.PlaceableAssets.Count; i++)
            {
                addButton(mgr.PlaceableAssets[i]);
            }
        }
コード例 #4
0
        private void Awake()
        {
            _manager = FindObjectOfType <EasyWorldBuilder>();
            _saveSys = FindObjectOfType <RuntimeSaving>();

            FlyCam       = gameObject.AddComponent <Camera>();
            _charControl = gameObject.AddComponent <CharacterController>();
            _charControl.gameObject.layer = LayerMask.NameToLayer("Ignore Raycast");
            gameObject.AddComponent <AudioListener>();

            _fpsControl = gameObject.AddComponent <FirstPersonController>();
            FpsCam      = _fpsControl.m_Camera;

            _flyControl = gameObject.AddComponent <SimpleCameraController>();
        }
コード例 #5
0
 private void Start()
 {
     Manager = EasyWorldBuilder.Instance;
 }