Example #1
0
        /// <summary>The build entity.</summary>
        /// <param name="entity">The entity.</param>
        /// <param name="entityWorld">The entityWorld.</param>
        /// <param name="args">The args.</param>
        /// <returns>The <see cref="Entity" />.</returns>
        public Entity BuildEntity(Entity entity, EntityWorld entityWorld, params object[] args)
        {
            entity.AddComponentFromPool <Position>();
            entity.AddComponentFromPool <Pickupable>();
            entity.AddComponentFromPool <Appearance>();
            entity.GetComponent <Appearance>().Initialize("Images/ManaCrystal.xml");
            entity.Refresh();

            return(entity);
        }
        /// <summary>The build entity.</summary>
        /// <param name="entity">The entity.</param>
        /// <param name="entityWorld">The entityWorld.</param>
        /// <param name="args">The args.</param>
        /// <returns>The <see cref="Entity" />.</returns>
        public Entity BuildEntity(Entity entity, EntityWorld entityWorld, params object[] args)
        {
            entity.AddComponentFromPool <Enchantment>();
            entity.AddComponentFromPool <Team>();
            entity.AddComponentFromPool <Position>();
            entity.AddComponentFromPool <Appearance>();

            entity.Refresh();

            return(entity);
        }
Example #3
0
        /// <summary>The build entity.</summary>
        /// <param name="entity">The entity.</param>
        /// <param name="entityWorld">The entityWorld.</param>
        /// <param name="args">The args.</param>
        /// <returns>The <see cref="Entity" />.</returns>
        public Entity BuildEntity(Entity entity, EntityWorld entityWorld, params object[] args)
        {
            entity.AddComponentFromPool <Position>();
            entity.AddComponentFromPool <Pickupable>();
            entity.GetComponent <Pickupable>().currentValue = 0.2f;
            entity.GetComponent <Pickupable>().maxValue     = 0;
            entity.AddComponentFromPool <Appearance>();

            entity.Refresh();

            return(entity);
        }
Example #4
0
        /// <summary>The build entity.</summary>
        /// <param name="entity">The entity.</param>
        /// <param name="entityWorld">The entityWorld.</param>
        /// <param name="args">The args.</param>
        /// <returns>The <see cref="Entity" />.</returns>
        public Entity BuildEntity(Entity entity, EntityWorld entityWorld, params object[] args)
        {
            entity.AddComponentFromPool <Health>();
            entity.AddComponentFromPool <ScreenPosition>();
            entity.AddComponentFromPool <PlatformPosition>();
            entity.AddComponentFromPool <PlayerNumber>();
            entity.AddComponentFromPool <Input>();

            entity.Refresh();

            return(entity);
        }
Example #5
0
        public void CreateDotEntity()
        {
            Entity entity = this.entityWorld.CreateEntity();

            entity.Group = "SNEKDOTS";

            entity.AddComponentFromPool <Texture2DComponent>();
            entity.AddComponentFromPool <ColorComponent>();
            entity.AddComponentFromPool <DotComponent>();

            entity.GetComponent <Texture2DComponent>().Init(contentManager, "Images/whitesquare");
            entity.GetComponent <ColorComponent>().Init(Color.Blue);
            ResetDotEntityPosition(entity);
            entity.Tag = "SNEKDOT";
        }
Example #6
0
        /// <summary>The build entity.</summary>
        /// <param name="entity">The entity.</param>
        /// <param name="entityWorld">The entityWorld.</param>
        /// <param name="args">The args.</param>
        /// <returns>The <see cref="Entity" />.</returns>
        public Entity BuildEntity(Entity entity, EntityWorld entityWorld, params object[] args)
        {
            entity.AddComponentFromPool <Health>();
            entity.AddComponentFromPool <Damage>();
            entity.AddComponentFromPool <Team>();
            entity.AddComponentFromPool <Position>();
            entity.AddComponentFromPool <Velocity>();
            entity.AddComponentFromPool <Collision>();
            entity.AddComponentFromPool <Appearance>();
            entity.AddComponentFromPool <SpawnPoint>();
            entity.AddComponentFromPool <StatsDisplay>();
            entity.AddComponentFromPool <AI>();


            entity.Refresh();

            return(entity);
        }
Example #7
0
 public Entity BuildEntity(Entity entity, EntityWorld entityWorld, params object[] args)
 {
     PhysicsBody body = entity.AddComponentFromPool<SPShared.ECS.Components.PhysicsBody>();
     body.Body.Shape = shipShape;
     PhysicsSystem physicsSystem = entityWorld.SystemManager.GetSystem<PhysicsSystem>();
     physicsSystem.AddBody(body);
     physicsSystem.AddConstraint(new Constraint2D(body.Body));
     return entity;
 }
 public Entity BuildEntity(Entity e, EntityWorld world, params object[] args)
 {
     e.Group = "EFFECTS";
     e.AddComponentFromPool<Transform>();
     e.AddComponent(new SpatialForm());
     e.AddComponent(new Expires());
     e.GetComponent<SpatialForm>().SpatialFormFile = "ShipExplosion";
     e.GetComponent<Expires>().LifeTime = 1000;
     return e;
 }
        /// <summary>The build entity.</summary>
        /// <param name="entity">The entity.</param>
        /// <param name="entityWorld">The entityWorld.</param>
        /// <param name="args">The args.</param>
        /// <returns>The <see cref="Entity" />.</returns>
        public Entity BuildEntity(Entity entity, EntityWorld entityWorld, params object[] args)
        {
            entity.Group = "EFFECTS";

            entity.AddComponentFromPool <TransformComponent>();
            entity.AddComponent(new SpatialFormComponent("BulletExplosion"));
            entity.AddComponent(new ExpiresComponent(1000));

            return(entity);
        }
Example #10
0
        /// <summary>The build entity.</summary>
        /// <param name="entity">The entity.</param>
        /// <param name="entityWorld">The entityWorld.</param>
        /// <param name="args">The args.</param>
        /// <returns>The <see cref="Entity" />.</returns>
        public Entity BuildEntity(Entity entity, EntityWorld entityWorld, params object[] args)
        {
            entity.Group = "BULLETS";

            entity.AddComponentFromPool <TransformComponent>();
            entity.AddComponent(new SpatialFormComponent("Missile"));
            entity.AddComponent(new VelocityComponent());
            entity.AddComponent(new ExpiresComponent(2000));

            return(entity);
        }
Example #11
0
        public Entity BuildEntity(Entity entity, EntityWorld entityWorld, params object[] args)
        {
            PhysicsBody body = entity.AddComponentFromPool <SPShared.ECS.Components.PhysicsBody>();

            body.Body.Shape = shipShape;
            PhysicsSystem physicsSystem = entityWorld.SystemManager.GetSystem <PhysicsSystem>();

            physicsSystem.AddBody(body);
            physicsSystem.AddConstraint(new Constraint2D(body.Body));
            return(entity);
        }
        public Entity BuildEntity(Entity e, EntityWorld world, params object[] args)
        {
            e.Group = "BULLETS";

            e.AddComponentFromPool<Transform>();
            e.AddComponent(new SpatialForm());
            e.AddComponent(new Velocity());
            e.AddComponent(new Expires());
            e.GetComponent<SpatialForm>().SpatialFormFile = "Missile";
            e.GetComponent<Expires>().LifeTime = 2000;
            return e;
        }
Example #13
0
        public Entity BuildEntity(Entity entity, EntityWorld entityWorld, params object[] args)
        {
            entity.Group = "SHIPS";

            entity.AddComponentFromPool <TransformComponent>();
            entity.AddComponent(new SpatialFormComponent("EnemyShip"));
            entity.AddComponent(new HealthComponent(10));
            entity.AddComponent(new WeaponComponent());
            entity.AddComponent(new EnemyComponent());
            entity.AddComponent(new VelocityComponent());

            return(entity);
        }
 public Entity BuildEntity(Entity e, EntityWorld world, params object[] args)
 {
     e.Group = "SHIPS";
     e.AddComponentFromPool<Transform>();
     e.AddComponent(new SpatialForm());
     e.AddComponent(new Health());
     e.AddComponent(new Weapon());
     e.AddComponent(new Enemy());
     e.AddComponent(new Velocity());
     e.GetComponent<SpatialForm>().SpatialFormFile = "EnemyShip";
     e.GetComponent<Health>().HP = 10;
     return e;
 }
Example #15
0
        /// <summary>The initialize player ship.</summary>
        private void InitializePlayerShip()
        {
            Entity entity = this.entityWorld.CreateEntity();

            entity.Group = "SHIPS";

            entity.AddComponentFromPool <TransformComponent>();
            entity.AddComponent(new SpatialFormComponent("PlayerShip"));
            entity.AddComponent(new HealthComponent(30));

            entity.GetComponent <TransformComponent>().X = this.GraphicsDevice.Viewport.Width * 0.5f;
            entity.GetComponent <TransformComponent>().Y = this.GraphicsDevice.Viewport.Height - 50;
            entity.Tag = "PLAYER";
        }
Example #16
0
        /// <summary>The initialize player ship.</summary>
        private void InitializePlayer()
        {
            Entity entity = this.entityWorld.CreateEntity();

            entity.Group = "SNEKPC";

            entity.AddComponentFromPool <Texture2DComponent>();
            entity.AddComponentFromPool <VelocityComponent>();
            entity.AddComponentFromPool <KeyboardInputComponent>();
            entity.AddComponentFromPool <SnakeHeadComponent>();
            entity.AddComponentFromPool <SnakeBodyComponent>();
            entity.AddComponentFromPool <SnakeTailComponent>();

            entity.GetComponent <Texture2DComponent>().Init(Content, "Images/whitesquare");
            Velocity velocity = new Velocity();

            velocity.Init(16f, 0);
            entity.GetComponent <VelocityComponent>().Init(velocity, new Velocity());
            entity.GetComponent <KeyboardInputComponent>().Init(new KeyboardState(), new KeyboardState());
            entity.GetComponent <SnakeBodyComponent>().Init(new Vector2(128, 128), Vector2.Zero, entity);
            entity.Tag = "SNEKPCHEAD";
        }
Example #17
0
        /// <summary>The build entity.</summary>
        /// <param name="entity">The entity.</param>
        /// <param name="entityWorld">The entityWorld.</param>
        /// <param name="args">The args.</param>
        /// <returns>The <see cref="Entity" />.</returns>
        public Entity BuildEntity(Entity entity, EntityWorld entityWorld, params object[] args)
        {
            entity.AddComponentFromPool <Health>();
            entity.GetComponent <Health>().maxHealth     = 20;
            entity.GetComponent <Health>().currentHealth = 20;
            entity.AddComponentFromPool <Team>();
            entity.AddComponentFromPool <Mana>();
            entity.AddComponentFromPool <Damage>();
            entity.AddComponentFromPool <SpellBook>();
            entity.AddComponentFromPool <Position>();
            entity.AddComponentFromPool <Velocity>();
            entity.AddComponentFromPool <Collision>();
            entity.AddComponentFromPool <Input>();
            entity.AddComponentFromPool <Appearance>();
            entity.AddComponentFromPool <Velocity>();

            entity.GetComponent <SpellBook>().spells.Add(new SummonDinoGoblinSpell());
            entity.GetComponent <SpellBook>().spells.Add(new SummonDinoGoblinSpell());
            entity.GetComponent <SpellBook>().spells.Add(new SummonDinoGoblinSpell());
            entity.GetComponent <SpellBook>().spells.Add(new SummonDinoGoblinSpell());
            entity.GetComponent <SpellBook>().spells.Add(new FireBallSpell());
            entity.GetComponent <SpellBook>().spells.Add(new FireLanceSpell());
            entity.GetComponent <SpellBook>().spells.Add(new RageSpell());
            entity.GetComponent <SpellBook>().spells.Add(new SummonFireBatSpell());
            entity.GetComponent <SpellBook>().spells.Add(new HasteSpell());

            entity.GetComponent <SpellBook>().Load();

            entity.GetComponent <Velocity>().moveSpeed        = 3;
            entity.GetComponent <Velocity>().currentMoveSpeed = 3;
            entity.GetComponent <Appearance>().Initialize("Images/FireCaster.xml");

            entity.GetComponent <Appearance>().image.isActive = true;
            entity.GetComponent <Appearance>().image.spriteSheetEffect.isActive = false;

            entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.CastDown]  = 2;
            entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.CastLeft]  = 1;
            entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.CastUp]    = 0;
            entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.CastRight] = 3;

            entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.MoveUp]    = 8;
            entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.MoveLeft]  = 9;
            entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.MoveDown]  = 10;
            entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.MoveRight] = 11;

            entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.AttackUp]    = 12;
            entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.AttackLeft]  = 13;
            entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.AttackDown]  = 14;
            entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.AttackRight] = 15;

            entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.Spawn] = 2;
            entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.Die]   = 16;

            entity.GetComponent <Appearance>().image.spriteSheetEffect.currentFrame.Y =
                entity.GetComponent <Appearance>().animationsMap[Appearance.Animation.Spawn];
            entity.GetComponent <Appearance>().image.spriteSheetEffect.isActive     = true;
            entity.GetComponent <Appearance>().image.spriteSheetEffect.isContinuous = false;
            entity.GetComponent <Appearance>().image.isActive = true;

            entity.Refresh();

            return(entity);
        }