public bool CreateObjectByDefinition(ObjectDefinition ObjectDefinition) { CBaseObject newObject = null; ObjectDefinition DefaultDef = DefinitionManager.QueryDefinitionByName(ObjectDefinition.ObjectClassType); // Try to load the game object first. if (CreateObjectDelegate != null) { newObject = CreateObjectDelegate(DefaultDef, ObjectDefinition); } // if the game object could not be loaded then this is likely a engine defined object. if (newObject == null) { newObject = EngineCreateObjectDelegate(DefaultDef, ObjectDefinition); } if (newObject != null) { Firecracker.engineInstance.AddObjectToList(newObject); } else { // This is not an object that actually exists. System.Diagnostics.Debug.Assert(false, "Uh oh. The level defined an object that doesn't exist."); return(false); } return(true); }
protected override void Initialize() { // load the game settings from file settings.loadFrom(Content.RootDirectory + "/" + GameSettings.defaultFileName); // set the screen resolution graphics.PreferredBackBufferWidth = settings.screenWidth; graphics.PreferredBackBufferHeight = settings.screenHeight; graphics.ApplyChanges(); // set the screen attributes / full screen mode Window.AllowUserResizing = false; if (settings.fullScreen) { // NOTE: may cause access violations in dual screen situations graphics.ToggleFullScreen(); } controlSystem.initialize(); menu.initialize(); console.initialize(); m_MouseManager.Initialize(); UIScreenManager.CreateInstance(); DefinitionManager.LoadDefinitions("Content\\Objects"); theCamera = new CameraBase(); theCamera.initialize(); maxTime[0] = 2; maxTime[1] = 60; base.Initialize(); }
public bool CreateObjectByName(string sObjectName) { // TODO: implement this. // similar to CreateObjectByDefinition, except that this // no properties are overloaded. ObjectDefinition objDef = DefinitionManager.QueryDefinitionByName(sObjectName); if (objDef.ObjectName.Length != 0 && objDef.ObjectClassType.Length != 0) { return(CreateObjectByDefinition(objDef)); } return(false); }