Пример #1
0
        /// <summary>
        /// If the entity to go to is a tree then we set it as our target tree.
        /// If the rntity to go to is a lumber mill then we set it as our target
        /// mill.
        /// 
        /// Otherwise it delegates to the parent's implementation.
        /// </summary>
        /// <param name="toEntity"></param>
        /// <param name="distance"></param>
        public override void MoveDistanceInFrontOfEntity(GameEntitity toEntity, int distance)
        {
            // If the target is a tree then save it
            // as a target.

            // If it is a lumbermill then save it
            // as a target.

            // Perform the normal logic.
            base.MoveDistanceInFrontOfEntity(toEntity, distance);
        }
Пример #2
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);

            #region These aren't the droids you are looking for.

            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 600;
            Content.RootDirectory = "Content";


            m_TreeList = new List<TreeEntity>();
            m_TreeList.Add(new TreeEntity(new Vector2(2 * 64, 4 * 24)));
            m_TreeList.Add(new TreeEntity(new Vector2(9 * 64 + 32, 7 * 24)));
            m_TreeList.Add(new TreeEntity(new Vector2(0 * 64, 0 * 24)));
            m_TreeList.Add(new TreeEntity(new Vector2(1 * 64, 10 * 24)));

            m_LumberMills = new List<LumberMill>();
            m_LumberMills.Add(new LumberMill(new Vector2(8 * 64, 8 * 24)));

            m_mouseSource = new Rectangle(0, 0, 19, 19);
            
            m_TestLayer = new MapLayer(new Vector2(m_LayerWidth, m_LayerHeight), new Vector2(64, 64));
        
            m_TestTile = new MapTile(new Vector2(0, 0), 0, new Vector2(64,64));

#endregion
            
            m_Gobling = new GoblinLumberjack(ENTITY_COLOR.RED, new Vector2(64 * 8, 0), DIRECTION.DOWN);
            
            #region These aren't the droids you are looking for.

            ((GoblinLumberjack)m_Gobling).SetTargetLumberMill(m_LumberMills[0]);
            
            m_Gobling.SetEntitySpeed(new Vector2(1, 1));
            m_mapList = new List<List<int>>();
            m_mapList.Add(new List<int>() { });
            #endregion
        }