Esempio n. 1
0
        /// <summary>
        /// Adds an IceSceneComponent to the Scenecomponents collection
        /// </summary>
        /// <param name="component">The IceSceneComponent to add</param>
        public void AddComponent(IceSceneComponent component)
        {
            //conkerjo. i think we should check if it's already owned by a scene and throw an exception here

            component.SetOwner(this);
            SceneComponents.Add(component);
        }
        internal static object DeepCopyIceSceneComponent(Type type, IceSceneComponent cloneFrom)
        {
            //Create a new instance of the component
            IceSceneComponent comp = (IceSceneComponent)type.Assembly.CreateInstance(type.FullName);

            //CopyPropertiesTo(comp, cloneFrom);
            cloneFrom.CopyValuesTo(comp);
            return(comp);
        }
Esempio n. 3
0
        /// <summary>
        /// Calls Update on all enabled SceneItems and their Corresponding Components along with the SceneComponents
        /// </summary>
        /// <param name="elapsed">The elapsed game time since the last Update</param>
        internal static void UpdateIceCream(float elapsed)
        {
            if (SceneManager.ActiveScene == null || !SceneManager.ActiveScene.Enabled)
            {
                return;
            }

            IceProfiler.StartProfiling(IceProfilerNames.ICE_CORE_MAIN_UPDATE);
            // Differentiate between being in Milkshake and a running game
            if (SceneManager.ActiveScene.isInGame == false)
            {
                SceneManager.ActiveScene.isInGame = true;
            }
            if (SceneManager.ActiveScene._hasBeenUpdatedOnce == false)
            {
                SceneManager.ActiveScene._hasBeenUpdatedOnce = true;
            }
            SceneManager.ActiveScene.RemoveItems();
            SceneManager.ActiveScene.RegisterItems();

            //Pump input
            Input.InputCore.Update(elapsed);

            //First update any scene components
            for (int i = 0; i < SceneManager.ActiveScene.SceneComponents.Count; i++)
            {
                IceSceneComponent comp = SceneManager.ActiveScene.SceneComponents[i];
                if (comp.Enabled == false)
                {
                    continue;
                }
                comp.Update(elapsed);
                if (activeSceneChanged == true)
                {
                    IceProfiler.StopProfiling(IceProfilerNames.ICE_CORE_MAIN_UPDATE);
                    return;
                }
            }

            // Physics.CollisionManager.CheckAndProcessCollisions();
            // Update Spatial Data
            for (int i = 0; i < SceneManager.ActiveScene.SceneItems.Count; i++)
            {
                SceneItem _item = SceneManager.ActiveScene.SceneItems[i];
                if (_item.IsTemplate == true)
                {
                    continue;
                }
                _item.Update(elapsed);
            }

            for (int i = 0; i < SceneManager.ActiveScene.SceneItems.Count; i++)
            {
                SceneItem _item = SceneManager.ActiveScene.SceneItems[i];
                if (_item.IsTemplate == true)
                {
                    continue;
                }
                // Update all its components
                UpdateItemsComponents(_item);
                if (_item.MarkForDelete == true)
                {
                    _itemsToDelete.Add(_item);
                }
                if (activeSceneChanged == true)
                {
                    IceProfiler.StopProfiling(IceProfilerNames.ICE_CORE_MAIN_UPDATE);
                    return;
                }
            }

            for (int i = 0; i < SceneManager.ActiveScene.ActiveCameras.Count; i++)
            {
                SceneManager.ActiveScene.ActiveCameras[i].Update(elapsed);
            }

            //if(SceneManager.networkSession != null)
            //{
            //UpdateNetworkToSend(elapsed);
            //}

            IceProfiler.StopProfiling(IceProfilerNames.ICE_CORE_MAIN_UPDATE);
        }