public static GameObject BuildActionProjectile(
            Game1 game,
            GameObject parent,
            ActionInfo actInfo,
            Vector2 position,
            Vector2 velocity,
            int lifetime,
            List<Shape> boundingBoxes)
        {
            GameObject entity = new GameObject(game);
            entity.SetParent(parent);

            Transform2DComponent transformComponent = new Transform2DComponent(
                entity,
                position,
                0.0f,
                Vector2.One);

            BoundingBoxComponent bbComponent = new BoundingBoxComponent(entity, boundingBoxes, true);
            CurrentActionComponent caComponent = new CurrentActionComponent(
                entity,
                new ActionComponent(DirectionalAction.Left, SecondaryAction.Stand, PrimaryAction.None),
                new Dictionary<ActionDefinition, ActionInfo>());
            LifetimeComponent lifetimeComponent = new LifetimeComponent(entity, lifetime);
            IsActionComponent isActionComponent = new IsActionComponent(entity, actInfo);
            MotionPropertiesComponent motionComponent = new MotionPropertiesComponent(entity, 1.0f);
            motionComponent.SetVelocity(velocity);

            entity.AddComponent(transformComponent);
            entity.AddComponent(bbComponent);
            entity.AddComponent(caComponent);
            entity.AddComponent(motionComponent);
            entity.AddComponent(lifetimeComponent);
            entity.AddComponent(isActionComponent);

            return entity;
        }
Esempio n. 2
0
 public IsActionComponent(GameObject parent, ActionInfo actionInfo)
     : base(parent)
 {
     this.ActionInfo = actionInfo;
 }