Beispiel #1
0
        /// <summary>
        /// Enable Unity objects to skip "DontDestroyOnLoad" when editor isn't playing so test runner passes.
        /// </summary>
        /// <param name="target"></param>
        public static void DontDestroyOnLoad(this Object target)
        {
#if UNITY_EDITOR
            if (UnityEditor.EditorApplication.isPlaying)
#endif
            Object.DontDestroyOnLoad(target);
        }
        /// <summary>
        /// Creates a new SpaceCenter Loader from the Injector context.
        /// </summary>
        public SpaceCenterLoader()
        {
            // Is this the parser context?
            if (!Injector.IsInPrefab)
            {
                throw new InvalidOperationException("Must be executed in Injector context.");
            }

            // Store values
            Value = generatedBody.celestialBody.gameObject.AddComponent <KSC>();
            Object.DontDestroyOnLoad(Value);
        }
Beispiel #3
0
        public static bool Register(Manager manager)
        {
            if (managers.ContainsKey(manager.GetType()))
            {
                return(false);
            }

            managers[manager.GetType()] = manager;
            if (manager.isPersistent)
            {
                Object.DontDestroyOnLoad(manager);
            }
            return(true);
        }
        public SpaceCenterLoader(CelestialBody body)
        {
            // Is this a spawned body?
            if (body.scaledBody == null || Injector.IsInPrefab)
            {
                throw new InvalidOperationException("The body must be already spawned by the PSystemManager.");
            }

            // Store values
            Value = body.GetComponent <KSC>();
            if (Value != null)
            {
                return;
            }
            Value = body.gameObject.AddComponent <KSC>();
            Value.Start();
            Object.DontDestroyOnLoad(Value);
        }
Beispiel #5
0
        public MapPointDisplay MapPointDisplay; //当前场景传送点

        /**创建本角色**/

        public void CreateMe(PlayerVo vo)
        {
            if (vo == null)
            {
                return;
            }
            if (_me != null)
            {
                return;
            }
            vo.Type = DisplayType.ROLE;
            _me     = new MeDisplay();
            //vo.ClothUrl = "Model/Role/" + vo.SysRoleBaseInfo.Model + "/Model/" + vo.SysRoleBaseInfo.Model +
            //              ".assetbundle";
            vo.ClothUrl = "Model/Role/" + "100001/Model/" + "100001" +
                          ".assetbundle";
            _me.SetVo(vo);
            if (_playerList.IndexOf(_me) == -1)
            {
                _playerList.Add(_me);
            }
            Object.DontDestroyOnLoad(_me.GoBase);
            Object.DontDestroyOnLoad(_me.GoCloth);
        }
Beispiel #6
0
 public static A dontDestroyOnLoad <A>(this A a) where A : Object
 {
     Object.DontDestroyOnLoad(a);
     return(a);
 }