コード例 #1
0
ファイル: MapTile.cs プロジェクト: ViWinfii/UltimaXNA
        /// <summary>
        /// Adds the passed entity to this Tile's entity collection, and forces a resort of the entities on this tile.
        /// </summary>
        /// <param name="entity"></param>
        public void OnEnter(AEntity entity)
        {
            // only allow one ground object.
            if (entity is Ground)
            {
                if (Ground != null)
                {
                    Ground.Dispose();
                }
                Ground = (Ground)entity;
            }

            // if we are receiving a Item with the same position and itemID as a static item, then replace the static item.
            if (entity is Item)
            {
                Item item = entity as Item;
                for (int i = 0; i < m_Entities.Count; i++)
                {
                    if (m_Entities[i] is Item)
                    {
                        Item comparison = m_Entities[i] as Item;
                        if (comparison.ItemID == item.ItemID &&
                            comparison.Z == item.Z)
                        {
                            m_Entities.RemoveAt(i);
                            i--;
                        }
                    }
                }
            }

            m_Entities.Add(entity);
            m_NeedsSorting = true;
        }
コード例 #2
0
ファイル: ObstacleHandler.cs プロジェクト: scikodot/manipusim
        public static void Dispose()
        {
            // dispose of the ground
            Ground.Dispose();

            // dispose of all the obstacles
            foreach (var obstacle in Obstacles)
            {
                obstacle.Dispose();
            }
        }