/// <summary> /// Call this to initialize a Behaviour with data supplied in a file. /// </summary> /// <param name="fileName">The file to load from.</param> public override void LoadContent(String fileName) { base.LoadContent(fileName); ObjectPlacementDefinition def = GameObjectManager.pInstance.pContentManager.Load <ObjectPlacementDefinition>(fileName); mCursor = new GameObject("GameObjects\\Interface\\PlacementCursor\\PlacementCursor"); mCursor.pPosition = mParentGOH.pPosition; GameObjectManager.pInstance.Add(mCursor); mCursorOffset = Vector2.Zero; mItemOffset = new Vector2(-4, -4); mItemSourceRect = new Rectangle(0, 0, 8, 8); mItemColor = new Color(255, 255, 255, 200); mAbsOffsetRange = def.mAbsOffsetRange; mRemoveClassifications = new List <MBHEngineContentDefs.GameObjectDefinition.Classifications>(1); mRemoveClassifications.Add(MBHEngineContentDefs.GameObjectDefinition.Classifications.WALL); mGetTileAtPositionMsg = new Level.GetTileAtPositionMessage(); mGetMapInfoMsg = new Level.GetMapInfoMessage(); mSetTileTypeAtPositionMsg = new Level.SetTileTypeAtPositionMessage(); mGetCurrentObjectMsg = new Inventory.GetCurrentObjectMessage(); mOnPlaceObjectMsg = new OnPlaceObjectMessage(); mAddObjectMsg = new Inventory.AddObjectMessage(); mSelectNextItemMsg = new Inventory.SelectNextItemMessage(); mGetTexture2DMsg = new SpriteRender.GetTexture2DMessage(); mPeekCurrentObjectMsg = new Inventory.PeekCurrentObjectMessage(); }
/// <summary> /// Constructor. /// </summary> /// <param name="clusterSize"> /// The number of Tile objects that make up a single wall of a cluster. Assumes square clusters. /// </param> public NavMesh(Int32 clusterSize) : base() { mClusterSize = clusterSize; mPlanner = new Planner(); // Remember the factory is static so make sure to only allocate it once. if (null == mNodeFactory) { mNodeFactory = new NavMeshTileGraphNodeFactory(); } mGetMapInfoMsg = new Level.GetMapInfoMessage(); mGetTileAtPositionMsg = new Level.GetTileAtPositionMessage(); }
/// <summary> /// Call this to initialize a Behaviour with data supplied in a file. /// </summary> /// <param name="fileName">The file to load from.</param> public override void LoadContent(String fileName) { base.LoadContent(fileName); //ExampleDefinition def = GameObjectManager.pInstance.pContentManager.Load<ExampleDefinition>(fileName); // We depend on the Map being loaded so that we can use the size of it to drive the size of the MiniMap. mGetMapInfoMsg = new Level.GetMapInfoMessage(); WorldManager.pInstance.pCurrentLevel.OnMessage(mGetMapInfoMsg); // For now just a hard coded scale from tile position to minimap pixel. mTileToMapScale = new Vector2(0.1f, 0.1f); // Since tile width drives the size of the map, it also drives how // we convert from world position to pixel index on the map. mWorldToMapScale = new Vector2(mTileToMapScale.X / mGetMapInfoMsg.mInfo_Out.mTileWidth, mTileToMapScale.Y / mGetMapInfoMsg.mInfo_Out.mTileHeight); // The map dimensions are used throughout this class. Int32 mapWidth = (Int32)((Single)mGetMapInfoMsg.mInfo_Out.mMapWidth * mTileToMapScale.X); Int32 mapHeight = (Int32)((Single)mGetMapInfoMsg.mInfo_Out.mMapHeight * mTileToMapScale.Y); mMiniMapSize = new Point(mapWidth, mapHeight); // Create a new texture to use as our MiniMap. mMapTexture = new Texture2D(GameObjectManager.pInstance.pGraphicsDevice, mMiniMapSize.X, mMiniMapSize.Y); // This array is how data will be written to the MiniMap. mColorData = new Color[mMiniMapSize.X * mMiniMapSize.Y]; Int32 safeZonePadding = 5; Int32 rightEdge = 160; Int32 bottomEdge = 90; mParentGOH.pPosX = rightEdge - mMiniMapSize.X - safeZonePadding; mParentGOH.pPosY = bottomEdge - mMiniMapSize.Y - safeZonePadding; mMarkers = new List <Marker>(32); }