Ejemplo n.º 1
0
        public static GameObject CreateShotGun(IModelForComponents model, PointF location)
        {
            GameObject gameObject = CreateShotWeapon(model, setupsWeapon, weaponSetupsShotGun, SizeShotGun, TypesWeapon.ShotGun, location);

            model.AddOrUpdateGameObject(gameObject);
            return(gameObject);
        }
Ejemplo n.º 2
0
        public static GameObject CreateAssaultRiffle(IModelForComponents model, PointF location)
        {
            GameObject gameObject = CreateShotWeapon(model, setupsWeapon, weaponSetupsAssaultRiffle, SizeAssaulRiffle, TypesWeapon.AssaultRifle, location);

            model.AddOrUpdateGameObject(gameObject);
            return(gameObject);
        }
Ejemplo n.º 3
0
        public static GameObject CreateGrenade(IModelForComponents model, PointF location, Vec2 startVelocity, IBullet grenadeBullet)
        {
            var      gameObject  = new GameObject(model, TypesGameObject.Grenade, TypesBehaveObjects.Active);
            ShapeDef circleShape = CreateBaseCircleDef(setupsWeapon, SizeGreanade);

            circleShape.Filter.CategoryBits = (ushort)CollideCategory.Grenade;
            circleShape.Filter.MaskBits     = (ushort)CollideCategory.Box | (ushort)CollideCategory.Stone;

            ShapeDef sensorDef = CreateBaseCircleDef(setupsWeapon, new SizeF(RadiusExplosionGrenade, RadiusExplosionGrenade));

            sensorDef.IsSensor            = true;
            sensorDef.Filter.CategoryBits = (ushort)CollideCategory.Grenade;
            sensorDef.Filter.MaskBits     = (ushort)CollideCategory.Player;

            var body = new SolidBody(gameObject, new RectangleF(location, SizeGreanade),
                                     new ShapeDef[] { circleShape, sensorDef }, setupsWeapon.linearDamping, startVelocity);

            gameObject.Components.Add(body);

            var explosion = new Explosion(gameObject, grenadeBullet);

            gameObject.Components.Add(explosion);

            model.AddOrUpdateGameObject(gameObject);

            return(gameObject);
        }
Ejemplo n.º 4
0
 public GameObject(IModelForComponents model, TypesGameObject typeGameObject, TypesBehaveObjects typeBehaveObject)
 {
     //иницализация всех полей
     ID         = GetID();
     Model      = model;
     Type       = typeGameObject;
     TypeBehave = typeBehaveObject;
 }
Ejemplo n.º 5
0
        public static GameObject CreateBush(IModelForComponents model, PointF location)
        {
            var gameObject = new GameObject(model, TypesGameObject.Bush, TypesBehaveObjects.Passive);

            TransparentBody bushBody = new TransparentBody(gameObject, new RectangleF(location, SizeBush));

            gameObject.Components.Add(bushBody);

            model.AddOrUpdateGameObject(gameObject);

            return(gameObject);
        }
Ejemplo n.º 6
0
        private static Weapon CreateShotWeapon(IModelForComponents model, PhysicsSetups physicsSetupsWeapon,
                                               WeaponSetups weaponSetups, SizeF sizeWeapon, TypesWeapon typeWeapon, PointF location)
        {
            var weapon = new Weapon(model, TypesGameObject.Weapon, TypesBehaveObjects.Active, typeWeapon);

            CreateStandartComponentForWeapon(weapon, physicsSetupsWeapon, weaponSetups, sizeWeapon, typeWeapon, location);

            var shot = new Shot(weapon);

            weapon.Components.Add(shot);

            return(weapon);
        }
Ejemplo n.º 7
0
        public static GameObject CreateGrenadeCollection(IModelForComponents model, PointF location)
        {
            var gameObject = new Weapon(model, TypesGameObject.Weapon, TypesBehaveObjects.Active, TypesWeapon.GrenadeCollection);

            CreateStandartComponentForWeapon(gameObject, setupsWeapon, weaponSetupsGrenadeCollection,
                                             SizeGrenadeCollection, TypesWeapon.GrenadeCollection, location);

            var throwGrenade = new Throw(gameObject, strengthThrowGrenade);

            gameObject.Components.Add(throwGrenade);

            model.AddOrUpdateGameObject(gameObject);

            return(gameObject);
        }
Ejemplo n.º 8
0
        public static GameObject CreateDeathZone(IModelForComponents model, float diameter)
        {
            var gameObject = new GameObject(model, TypesGameObject.DeathZone, TypesBehaveObjects.Active);

            BodyZone bodyZone = new BodyZone(gameObject, diameter);

            gameObject.Components.Add(bodyZone);

            DamageZone damageZone = new DamageZone(gameObject);

            gameObject.Components.Add(damageZone);

            model.AddOrUpdateGameObject(gameObject);

            return(gameObject);
        }
Ejemplo n.º 9
0
        public static GameObject CreateStone(IModelForComponents model, PointF location)
        {
            var      gameObject = new GameObject(model, TypesGameObject.Stone, TypesBehaveObjects.Passive);
            ShapeDef CircleDef  = CreateBaseCircleDef(setupsStoneAndTree, SizeStone);

            CircleDef.Filter.CategoryBits = (ushort)CollideCategory.Stone;
            CircleDef.Filter.MaskBits     = (ushort)CollideCategory.Player |
                                            (ushort)CollideCategory.Grenade | (ushort)CollideCategory.Loot;

            var body = new SolidBody(gameObject, new RectangleF(location, SizeStone), new ShapeDef[] { CircleDef });

            gameObject.Components.Add(body);

            model.AddOrUpdateGameObject(gameObject);

            return(gameObject);
        }
Ejemplo n.º 10
0
        public static GameObject CreateBox(IModelForComponents model, PointF location)
        {
            var gameObject = new GameObject(model, TypesGameObject.Box, TypesBehaveObjects.Passive);

            var shapeBox = CreateBaseRectangleDef(setupsStillObject, SizeBox);

            shapeBox.Filter.CategoryBits = (ushort)CollideCategory.Box;
            shapeBox.Filter.MaskBits     = (ushort)CollideCategory.Player |
                                           (ushort)CollideCategory.Grenade | (ushort)CollideCategory.Loot;

            var body = new SolidBody(gameObject, new RectangleF(location, SizeBox), new ShapeDef[] { shapeBox });

            gameObject.Components.Add(body);

            model.AddOrUpdateGameObject(gameObject);

            return(gameObject);
        }
Ejemplo n.º 11
0
        public static Gamer CreateGamer(IModelForComponents model, PointF location)
        {
            var      gameObject = new Gamer(model, TypesGameObject.Player, TypesBehaveObjects.Active);
            ShapeDef CircleDef  = CreateBaseCircleDef(setupsGamer, SizeGamer);

            CircleDef.Filter.CategoryBits = (ushort)CollideCategory.Player;
            CircleDef.Filter.MaskBits     = (ushort)CollideCategory.Box | (ushort)CollideCategory.Stone
                                            | (ushort)CollideCategory.Grenade;

            var body = new SolidBody(gameObject, new RectangleF(location, SizeGamer), new ShapeDef[] { CircleDef });

            gameObject.Components.Add(body);

            var movement = new Movement(gameObject, SpeedGamer);

            gameObject.Components.Add(movement);

            var collector = new Collector(gameObject);

            gameObject.Components.Add(collector);

            var currentWeapon = new CurrentWeapon(gameObject);

            gameObject.Components.Add(currentWeapon);

            var healthy = new Healthy(gameObject);

            gameObject.Components.Add(healthy);

            var statistics = new Statistics(gameObject);

            gameObject.Components.Add(statistics);

            model.AddOrUpdateGameObject(gameObject);
            model.Players.Add(gameObject);

            return(gameObject);
        }
Ejemplo n.º 12
0
 public Modifier(IModelForComponents model, TypesGameObject typeGameObject, TypesBehaveObjects typeBehaveObject)
     : base(model, typeGameObject, typeBehaveObject)
 {
 }
Ejemplo n.º 13
0
 public Weapon(IModelForComponents model, TypesGameObject typeGameObject, TypesBehaveObjects typeBehaveObject, TypesWeapon typeWeapon)
     : base(model, typeGameObject, typeBehaveObject)
 {
     TypeWeapon = typeWeapon;
 }