Пример #1
0
 public TimedEventComponent(EasyTopDownGame game, double interval, Action callback, int maxCount)
     : base(game)
 {
     this.interval = interval;
     this.callback = callback;
     this.maxCount = maxCount;
 }
Пример #2
0
 public TimedEventComponent(EasyTopDownGame game, double interval, Action callback, int maxCount)
     : base(game)
 {
     this.interval = interval;
     this.callback = callback;
     this.maxCount = maxCount;
 }
Пример #3
0
 public static void AttachOnCollisionHandlers(Body body, EasyTopDownGame game)
 {
     foreach (Fixture fixture in body.FixtureList)
     {
         fixture.OnCollision += game.OnFixtureCollision;
     }
 }
Пример #4
0
 public ProjectileComponent(EasyTopDownGame game, EasyGameComponent originatingComponent, string sheetName, Vector2 direction, float velocity)
     : base(game, sheetName)
 {
     SetStartPosition(originatingComponent, direction);
     SetInMotion(direction, velocity);
     this.Body.IsBullet = true;
 }
Пример #5
0
 public InputHandlerComponent(EasyTopDownGame game, Action callback, PlayerIndex playerIndex, params object[] inputs) : base(game)
 {
     this.game        = game;
     this.callback    = callback;
     this.playerIndex = playerIndex;
     this.InitializeInputs(inputs);
 }
Пример #6
0
 public ProjectileComponent(EasyTopDownGame game, EasyGameComponent originatingComponent, string sheetName, Vector2 direction, float velocity)
     : base(game, sheetName)
 {
     SetStartPosition(originatingComponent, direction);
     SetInMotion(direction, velocity);
     this.Body.IsBullet = true;
 }
Пример #7
0
 public static void AttachOnCollisionHandlers(Body body, EasyTopDownGame game)
 {
     foreach (Fixture fixture in body.FixtureList)
     {
         fixture.OnCollision += game.OnFixtureCollision;
     }
 }
Пример #8
0
        /// <summary>
        /// Can be called by implementers who do not want default values for imageName, Category, Texture or Physics
        /// </summary>
        /// <param name="game"></param>
        public EasyGameComponent(EasyTopDownGame game)
            : base(game)
        {
            this.game = game;

            initialize();
        }
Пример #9
0
        /// <summary>
        /// Can be called by implementers who do not want default values for imageName, Category, Texture or Physics
        /// </summary>
        /// <param name="game"></param>
        public EasyGameComponent(EasyTopDownGame game)
            : base(game)
        {
            this.game = game;

            initialize();
        }
Пример #10
0
 public InputHandlerComponent(EasyTopDownGame game, Action callback, PlayerIndex playerIndex, params object[] inputs)
     : base(game)
 {
     this.game = game;
     this.callback = callback;
     this.playerIndex = playerIndex;
     this.InitializeInputs(inputs);
 }
Пример #11
0
 public PlayerScoreDisplay(EasyTopDownGame game, PlayerIndex playerIndex, string fontName) : base(game, fontName)
 {
     Name          = "Player " + playerIndex.ToString();
     Score         = 0;
     Scale         = 1.0f;
     SecondsToLive = -1;
     LayerDepth    = LayerDepths.Front;
 }
Пример #12
0
 public WanderingEnemyGameComponent(EasyTopDownGame easyGame, String imageName)
     : base(easyGame, imageName)
 {
     DecisionCycleMinLength = 0;
     DecisionCycleMaxLength = 5;
     Acceleration = 2;
     currentDirection = Vector2.Zero;
     Body.FixedRotation = true;
 }
Пример #13
0
 public RotatingPlayerComponent(EasyTopDownGame game, String sheetName, PlayerIndex playerIndex)
     : base(game, sheetName)
 {
     this.playerIndex           = playerIndex;
     base.Acceleration          = 6;
     base.MaxVelocity           = PlayerGameComponent.DEFAULT_PLAYER_MAX_VELOCITY;
     base.InputChecker          = new DirectionInputChecker(playerIndex);
     base.currentAnimationFrame = 0;
 }
Пример #14
0
 public RotatingPlayerComponent(EasyTopDownGame game, String sheetName, PlayerIndex playerIndex)
     : base(game, sheetName)
 {
     this.playerIndex = playerIndex;
     base.Acceleration = 6;
     base.MaxVelocity = PlayerGameComponent.DEFAULT_PLAYER_MAX_VELOCITY;
     base.InputChecker = new DirectionInputChecker(playerIndex);
     base.currentAnimationFrame = 0;
 }
Пример #15
0
 public PlayerScoreDisplay(EasyTopDownGame game, PlayerIndex playerIndex, string fontName)
     : base(game, fontName)
 {
     Name = "Player " + playerIndex.ToString();
     Score = 0;
     Scale = 1.0f;
     SecondsToLive = -1;
     LayerDepth = LayerDepths.Front;
 }
Пример #16
0
 public WanderingEnemyGameComponent(EasyTopDownGame easyGame, String imageName)
     : base(easyGame, imageName)
 {
     DecisionCycleMinLength = 0;
     DecisionCycleMaxLength = 5;
     Acceleration           = 2;
     currentDirection       = Vector2.Zero;
     Body.FixedRotation     = true;
 }
Пример #17
0
 public BackgroundGameComponent(EasyTopDownGame game, string imageName, Rectangle tileArea) : base(game)
 {
     this.game       = game;
     this.imageName  = imageName;
     this.tileArea   = tileArea;
     this.LayerDepth = LayerDepths.Background;
     texture         = game.Content.Load <Texture2D>(imageName);
     CalculateScalingFactor();
 }
Пример #18
0
 /// <summary>
 /// Creates a new EasyGameComponent
 /// </summary>
 /// <param name="game">The EasyTopDownGame instance that this component will be attached to.</param>
 /// <param name="imageName">Sets ImageName()</param>
 public EasyGameComponent(EasyTopDownGame game, String imageName)
     : base(game)
 {
     this.game = game;
     this.imageName = imageName;
     this.Category = imageName;
     this.texture = this.game.Content.Load<Texture2D>(imageName);
     initialize();
     InitializePhysics();
 }
Пример #19
0
 /// <summary>
 /// Creates a new EasyGameComponent
 /// </summary>
 /// <param name="game">The EasyTopDownGame instance that this component will be attached to.</param>
 /// <param name="imageName">Sets ImageName()</param>
 public EasyGameComponent(EasyTopDownGame game, String imageName)
     : base(game)
 {
     this.game      = game;
     this.imageName = imageName;
     this.Category  = imageName;
     this.texture   = this.game.Content.Load <Texture2D>(imageName);
     initialize();
     InitializePhysics();
 }
Пример #20
0
 public BackgroundGameComponent(EasyTopDownGame game, string imageName, Rectangle tileArea)
     : base(game)
 {
     this.game = game;
     this.imageName = imageName;
     this.tileArea = tileArea;
     this.LayerDepth = LayerDepths.Background;
     texture = game.Content.Load<Texture2D>(imageName);
     CalculateScalingFactor();
 }
Пример #21
0
 public TextEffect(EasyTopDownGame game, string fontName, string message) : base(game)
 {
     this.game          = game;
     FontColor          = Color.White;
     this.FontName      = fontName;
     this.Scale         = 1;
     this.Message       = message;
     this.SecondsToLive = -1;
     FlashColor         = FontColor;
     FlashInterval      = -1;
 }
Пример #22
0
 public AnimatedGameComponent(EasyTopDownGame game, string sheetName)
     : base(game)
 {
     base.imageName       = sheetName;
     this.Category        = sheetName;
     LayerDepth           = LayerDepths.Middle;
     this.SecondsPerFrame = .2;
     spriteSheet          = game.Content.Load <SpriteSheet>(sheetName);
     Initialize();
     InitializePhysics();
     Scale = 1;
 }
 public FourDirectionPlayerComponent(EasyTopDownGame easyGame, String imageName, PlayerIndex playerIndex)
     : base(easyGame, imageName)
 {
     this.playerIndex = playerIndex;
     Acceleration = 20f;
     base.MaxVelocity = 2f;
     base.InputChecker = new DirectionInputChecker(playerIndex);
     base.currentAnimationFrame = 0;
     Body.LinearDamping = 30;
     Body.Mass = 3;
     Body.Restitution = 0f;
 }
Пример #24
0
 public TextEffect(EasyTopDownGame game, string fontName, string message)
     : base(game)
 {
     this.game = game;
     FontColor = Color.White;
     this.FontName = fontName;
     this.Scale = 1;
     this.Message = message;
     this.SecondsToLive = -1;
     FlashColor = FontColor;
     FlashInterval = -1;
 }
 public FourDirectionPlayerComponent(EasyTopDownGame easyGame, String imageName, PlayerIndex playerIndex)
     : base(easyGame, imageName)
 {
     this.playerIndex           = playerIndex;
     Acceleration               = 20f;
     base.MaxVelocity           = 2f;
     base.InputChecker          = new DirectionInputChecker(playerIndex);
     base.currentAnimationFrame = 0;
     Body.LinearDamping         = 30;
     Body.Mass        = 3;
     Body.Restitution = 0f;
 }
Пример #26
0
 public AnimatedGameComponent(EasyTopDownGame game, string sheetName)
     : base(game)
 {
     base.imageName = sheetName;
     this.Category = sheetName;
     LayerDepth = LayerDepths.Middle;
     this.SecondsPerFrame = .2;
     spriteSheet = game.Content.Load<SpriteSheet>(sheetName);
     Initialize();
     InitializePhysics();
     Scale = 1;
 }
Пример #27
0
 public PlayerGameComponent(EasyTopDownGame easyGame, String imageName, PlayerIndex playerIndex)
     : base(easyGame, imageName)
 {
     this.playerIndex = playerIndex;
     base.Acceleration = DEFAULT_PLAYER_ACCELERATION;
     base.MaxVelocity = DEFAULT_PLAYER_MAX_VELOCITY;
     base.InputChecker = new DirectionInputChecker(playerIndex);
     base.Body.FixedRotation = true;
     base.Body.IsStatic = false;
     Body.LinearDamping = 30;
     Body.Mass = 3;
     Body.Restitution = 0f;
 }
Пример #28
0
 public PlayerGameComponent(EasyTopDownGame easyGame, String imageName, PlayerIndex playerIndex)
     : base(easyGame, imageName)
 {
     this.playerIndex        = playerIndex;
     base.Acceleration       = DEFAULT_PLAYER_ACCELERATION;
     base.MaxVelocity        = DEFAULT_PLAYER_MAX_VELOCITY;
     base.InputChecker       = new DirectionInputChecker(playerIndex);
     base.Body.FixedRotation = true;
     base.Body.IsStatic      = false;
     Body.LinearDamping      = 30;
     Body.Mass        = 3;
     Body.Restitution = 0f;
 }
Пример #29
0
 public EffectGameComponent(EasyTopDownGame game, String sheetName)
     : base(game)
 {
     SpriteSheet = game.Content.Load<SpriteSheet>(sheetName);
     this.game = game;
     ImagePrefix = sheetName;
     CurrentFrame = 0;
     SecondsPerFrame = 0.1;
     MaxLoops = 1;
     Position = new Vector2(0, 0);
     OverlayColor = Color.White;
     Rotation = 0;
     Scale = 1;
     LayerDepth = LayerDepths.Front;
 }
Пример #30
0
 public EffectGameComponent(EasyTopDownGame game, String sheetName)
     : base(game)
 {
     SpriteSheet     = game.Content.Load <SpriteSheet>(sheetName);
     this.game       = game;
     ImagePrefix     = sheetName;
     CurrentFrame    = 0;
     SecondsPerFrame = 0.1;
     MaxLoops        = 1;
     Position        = new Vector2(0, 0);
     OverlayColor    = Color.White;
     Rotation        = 0;
     Scale           = 1;
     LayerDepth      = LayerDepths.Front;
 }
Пример #31
0
 public Room(EasyTopDownGame game)
 {
     this.game        = game;
     this.functionMap = new Dictionary <char, Func <EasyGameComponent> >();
     this.nameMap     = new Dictionary <char, string>();
 }
Пример #32
0
 public RotatingWanderingComponent(EasyTopDownGame game, string sheetName)
     : base(game, sheetName)
 {
     this.Acceleration = 4;
 }
Пример #33
0
 public RotatingWanderingComponent(EasyTopDownGame game, string sheetName)
     : base(game, sheetName)
 {
     this.Acceleration = 4;
 }
Пример #34
0
 public ConsumableGameComponent(EasyTopDownGame game, String imageName)
     : base(game, imageName)
 {
 }
Пример #35
0
 public Room(EasyTopDownGame game)
 {
     this.game = game;
     this.functionMap = new Dictionary<char, Func<EasyGameComponent>>();
     this.nameMap = new Dictionary<char, string>();
 }
 public AnimatedRotatingGameComponent(EasyTopDownGame game, string sheetName)
     : base(game, sheetName)
 {
 }
Пример #37
0
 public ConsumableGameComponent(EasyTopDownGame game, String imageName)
     : base(game, imageName)
 {
 }
Пример #38
0
 public AnimatedRotatingGameComponent(EasyTopDownGame game, string sheetName)
     : base(game, sheetName)
 {
 }