internal static object DeepCopySquidComponent(Type type, SquidComponent cloneFrom) { //Create a new instance of the component SquidComponent comp = (SquidComponent)type.Assembly.CreateInstance(type.FullName); //CopyPropertiesTo(comp, cloneFrom); cloneFrom.CopyValuesTo(comp); return(comp); }
//private static void UpdateNetworkToSend(float elapsed) //{ // NetworkSession session = SceneManager.networkSession; // if (SceneManager.IsNetworkOwner) // { // //foreach (var item in SceneManager.ActiveScene.SceneItems) // //{ // // packetWriter.Write((int)NetworkDataType.UpdateSceneItem); // // packetWriter.Write(item.Position); // //} // //LocalNetworkGamer server = (LocalNetworkGamer)session.Host; // //server.SendData(packetWriter, SendDataOptions.InOrder); // } // session.Update(); //} private static void UpdateItemsComponents(SceneItem item) { if (item.Components == null) { return; } for (int i = 0; i < item.Components.Count; i++) { SquidComponent _component = item.Components[i]; if (_component.Enabled == true) { _component.Update(SquidEngine.Game.Instance.Elapsed); } } }