public NormalBullet() : base() { this.ObjectType = eObjectType.BULLET; IResourceManager resourceManager = SCSServices.Instance.ResourceManager; // Move component MoveComponent moveCOm = MoveComponentFactory.CreateComponent(); MoveBehavior moveBehavior = new MoveBehavior(); moveBehavior.Velocity = new Vector2(200, 0); moveCOm.AddBehavior(eMoveBehaviorType.NORMAL_FLYING, moveBehavior); this.AddComponent(moveCOm); // Physic component PhysicComponent phyCOm = PhysicComponentFactory.CreateComponent(); phyCOm.Bound = new Microsoft.Xna.Framework.Rectangle(0, 0, 10, 10); this.AddComponent(phyCOm); // Logic component LogicComponent logicCOm = LogicComponentFactory.CreateComponent(); logicCOm.LogicBehavior = new B_NormalLogicBehavior(); this.AddComponent(logicCOm); // Render component RenderComponent renCOm = RenderComponentFactory.CreateComponent(); RenderBehavior renBehavior = new RenderBehavior(); renBehavior.Sprite = resourceManager.GetResource<ISprite>("Bullets/B_Pea"); renBehavior.SpriteBound = new Rectangle(0, 0, 29, 22); renCOm.AddBehavior(eMoveRenderBehaviorType.B_FLYING, renBehavior); this.AddComponent(renCOm); // Init data }
public override IBehavior<MessageType> Clone() { MoveBehavior moveBehavior = new MoveBehavior(); moveBehavior.Velocity = this.Velocity; moveBehavior.VelocityAdd = this.VelocityAdd; return moveBehavior; }
public NormalPlant() : base() { IResourceManager resourceManager = SCSServices.Instance.ResourceManager; // Move component MoveComponent moveCOm = MoveComponentFactory.CreateComponent(); // Stand MoveBehavior moveBehavior = new MoveBehavior(); moveBehavior.Velocity = Vector2.Zero; moveCOm.AddBehavior(eMoveBehaviorType.STANDING, moveBehavior); this.AddComponent(moveCOm); // Render component RenderComponent renCOm = RenderComponentFactory.CreateComponent(); // Stand RenderBehavior renBehavior = new RenderBehavior(); renBehavior.Sprite = resourceManager.GetResource<ISprite>("Plants/DoublePea/DoublePea"); renBehavior.SpriteBound = new Rectangle(0, 0, 100, 55); renCOm.AddBehavior(eMoveRenderBehaviorType.STANDING, renBehavior); this.AddComponent(renCOm); // Physic component PhysicComponent phyCOm = PhysicComponentFactory.CreateComponent(); this.AddComponent(phyCOm); // Logic component LogicComponent logicCOm = LogicComponentFactory.CreateComponent(); logicCOm.LogicBehavior = new P_NormalLogicBehavior(); this.AddComponent(logicCOm); renCOm.ChangeBehavior(eMoveRenderBehaviorType.STANDING); }
public NormalZombie() : base() { IResourceManager resourceManager = SCSServices.Instance.ResourceManager; // Move component MoveComponent moveCOm = MoveComponentFactory.CreateComponent(); // Stand MoveBehavior moveBehavior = new MoveBehavior(); moveBehavior.Velocity = Vector2.Zero; moveCOm.AddBehavior(eMoveBehaviorType.STANDING, moveBehavior); // Run moveBehavior = new MoveBehavior(); moveBehavior.Velocity = new Vector2(-100, 0); moveCOm.AddBehavior(eMoveBehaviorType.RUNNING, moveBehavior); this.AddComponent(moveCOm); // Physic component PhysicComponent phyCOm = PhysicComponentFactory.CreateComponent(); this.AddComponent(phyCOm); // Logic component LogicComponent logicCOm = LogicComponentFactory.CreateComponent(); logicCOm.LogicBehavior = new Z_NormalLogicBehavior(); this.AddComponent(logicCOm); // Render component RenderComponent renCOm = RenderComponentFactory.CreateComponent(); // Run RenderBehavior renBehavior = new RenderBehavior(); renBehavior.Sprite = resourceManager.GetResource<ISprite>("Zombies/Nameless/Walk"); renBehavior.SpriteBound = new Rectangle(0, 0, 73, 100); renCOm.AddBehavior(eMoveRenderBehaviorType.ZO_NORMAL_RUNNING, renBehavior); // Eat renBehavior = new RenderBehavior(); renBehavior.Sprite = resourceManager.GetResource<ISprite>("Zombies/Nameless/Attack"); renBehavior.SpriteBound = new Rectangle(0, 0, 89, 101); renCOm.AddBehavior(eMoveRenderBehaviorType.ZO_NORMAL_EATING, renBehavior); this.AddComponent(renCOm); }
public static MoveBehavior CreateBehavior() { MoveBehavior result = new MoveBehavior(); return result; }