Example #1
0
        public void SetMapInstance(MapPacket packet)
        {
            _mapInstance = new MapInstance(packet);

            for (int i = 0; i < MapEventEntities.Count; i++)
            {
                MapEventEntities[i].Destroy();
            }
            MapEventEntities.Clear();

            //
            // DESTROY players here (when they are in the map packet)
            //

            for (int i = 0; i < EnemyEntites.Count; i++)
            {
                EnemyEntites[i].Destroy();
            }
            EnemyEntites.Clear();

            for (int i = 0; i < ProjectileEntites.Count; i++)
            {
                ProjectileEntites[i].Destroy();
            }
            ProjectileEntites.Clear();

            for (int i = 0; i < MapItemEntities.Count; i++)
            {
                MapItemEntities[i].Destroy();
            }
            MapItemEntities.Clear();

            _mapDataChanged = true;
        }
Example #2
0
        //public void AddMapPlayer()

        public void AddMapEnemy(MapEnemy mapEnemy, bool addToMap = true)
        {
            Entity entity = Entity.CreateInstance(GameState.Instance.EntityManager);

            entity.GetTransform().Parent = this.Parent.GetTransform();
            new MapEnemyComponent(entity, mapEnemy);
            EnemyEntites.Add(entity);
            if (addToMap)
            {
                _mapInstance.AddMapEnemy(mapEnemy);
            }
        }