Exemplo n.º 1
0
            public void Movement()
            {
                if (!EnableMovement || CurrentPath.Count == 0)
                {
                    StopMovement();
                    return;
                }
                Vector2 position = MainMotor.GetWorldPosition();

                if ((position - CurrentPath[CurrentPath.Count - 1]).Length() <= 1 || RailJoint == null)
                {
                    CurrentPath.RemoveAt(CurrentPath.Count - 1);
                    if (CurrentPath.Count == 0)
                    {
                        StopMovement();
                        return;
                    }
                    else
                    {
                        StopMovement(false);
                    }
                    RailJoint      = (IObjectRailJoint)GlobalGame.CreateObject("RailJoint", position);
                    TargetObject   = (IObjectTargetObjectJoint)GlobalGame.CreateObject("TargetObjectJoint", CurrentPath[CurrentPath.Count - 1]);
                    RailAttachment = (IObjectRailAttachmentJoint)GlobalGame.CreateObject("RailAttachmentJoint", position);
                    RailJoint.SetTargetObjectJoint(TargetObject);
                    RailAttachment.SetRailJoint(RailJoint);
                    RailAttachment.SetTargetObject(Hull);
                    RailAttachment.SetMotorEnabled(true);
                    RailAttachment.SetMaxMotorTorque(10);
                    RailAttachment.SetMotorSpeed(Speed);
                    Hull.SetBodyType(BodyType.Dynamic);
                }
            }
Exemplo n.º 2
0
            public void CallAirDrop(TPlayer player, int count = 1)
            {
                Vector2 pos = player.User.GetPlayer().GetWorldPosition();

                if (IsHacking(player.Team))
                {
                    TPlayer enemy = GetRandomPlayer(GetEnemyTeam(player.Team), true);
                    if (enemy != null)
                    {
                        pos = enemy.User.GetPlayer().GetWorldPosition();
                    }
                    else
                    {
                        pos = GetRandomWorldPoint();
                    }
                }
                pos.Y = WorldTop;
                int offset = 20;

                pos.X -= offset * (count - 1);
                for (int i = 0; i < count; i++)
                {
                    GlobalGame.CreateObject("SupplyCrate00", pos);
                    pos.X += offset;
                    pos.Y += GlobalRandom.Next(-offset, offset);
                }
            }
Exemplo n.º 3
0
            public void BreakWeapon(bool isExplosion)
            {
                IPlayer pl = User.GetPlayer();

                if (pl != null && !pl.IsDead)
                {
                    if (pl.CurrentWeaponDrawn == WeaponItemType.Rifle)
                    {
                        if (GlobalRandom.Next(0, 100) < (int)(WeaponBreakingChance * Armor.BreakWeaponFactor))
                        {
                            Vector2         pos    = pl.GetWorldPosition();
                            RifleWeaponItem weapon = pl.CurrentPrimaryWeapon;
                            if ((weapon.WeaponItem == WeaponItem.BAZOOKA || weapon.WeaponItem == WeaponItem.GRENADE_LAUNCHER ||
                                 weapon.WeaponItem == WeaponItem.FLAMETHROWER) && weapon.CurrentAmmo > 0 && (GlobalRandom.Next(0, 100) < WeaponExplosionChance || isExplosion))
                            {
                                GlobalGame.TriggerExplosion(pos);
                            }
                            pl.RemoveWeaponItemType(WeaponItemType.Rifle);
                            GlobalGame.PlayEffect("CFTXT", pl.GetWorldPosition(), "WEAPON BROKEN");
                            GlobalGame.CreateObject("MetalDebris00A", pos, (float)rnd.NextDouble());
                            pos.X += 5;
                            GlobalGame.CreateObject("MetalDebris00B", pos, (float)rnd.NextDouble());
                            pos.X -= 10;
                            GlobalGame.CreateObject("MetalDebris00C", pos, (float)rnd.NextDouble());
                        }
                    }
                }
            }
Exemplo n.º 4
0
 //methods
 public TPlayer(IUser user)
 {
     User          = user;
     Body          = user.GetPlayer();
     Name          = User.Name;
     Team          = Body.GetTeam();
     StatusDisplay = (IObjectText)GlobalGame.CreateObject("Text");
     StatusDisplay.SetTextAlignment(TextAlignment.Middle);
 }
Exemplo n.º 5
0
            public void ContinueMineStrike()
            {
                Stage++;
                int continuing = 70;
                int bulletPer  = 10;

                if (Stage % bulletPer == 0)
                {
                    Area    area   = GlobalGame.GetCameraArea();
                    Vector2 newPos = new Vector2(GlobalRandom.Next((int)area.Left, (int)area.Right), WorldTop);
                    GlobalGame.CreateObject("WpnMineThrown", newPos);
                }
                if (Stage >= continuing)
                {
                    MinusAmmo();
                }
            }
Exemplo n.º 6
0
            public void CallReinforcement(TPlayer player)
            {
                Area area = GlobalGame.GetCameraArea();

                for (int i = 0; i < PlayerList.Count; i++)
                {
                    TPlayer pl = PlayerList[i];
                    if (pl != null && pl.IsActive() && pl != player && pl.Team == player.Team && !pl.IsAlive())
                    {
                        float   x           = GlobalRandom.Next((int)(area.Left + area.Width / 5), (int)(area.Right - area.Width / 5));
                        float   y           = WorldTop + 50;
                        IObject crate       = GlobalGame.CreateObject("SupplyCrate00", new Vector2(x, y));
                        IObject platf       = GlobalGame.CreateObject("Lift00A", new Vector2(x, y - 10));
                        IObject leftBorder  = GlobalGame.CreateObject("Lift00A", new Vector2(x - 10, y), (float)Math.PI / -2);
                        IObject rightBorder = GlobalGame.CreateObject("Lift00A", new Vector2(x + 10, y), (float)Math.PI / 2);
                        leftBorder.SetBodyType(BodyType.Dynamic);
                        rightBorder.SetBodyType(BodyType.Dynamic);
                        IObjectDestroyTargets destroy = (IObjectDestroyTargets)GlobalGame.CreateObject("DestroyTargets", new Vector2(x, y));
                        platf.SetMass(1e-3f);
                        leftBorder.SetMass(1e-3f);
                        rightBorder.SetMass(1e-3f);
                        IObjectWeldJoint joint = (IObjectWeldJoint)GlobalGame.CreateObject("WeldJoint", new Vector2(x, y));
                        joint.AddTargetObject(crate);
                        joint.AddTargetObject(platf);
                        joint.AddTargetObject(rightBorder);
                        joint.AddTargetObject(leftBorder);
                        destroy.AddTriggerDestroyObject(crate);
                        destroy.AddObjectToDestroy(joint);
                        destroy.AddObjectToDestroy(platf);
                        destroy.AddObjectToDestroy(leftBorder);
                        destroy.AddObjectToDestroy(rightBorder);
                        ObjectsToRemove.Add(destroy);
                        ObjectsToRemove.Add(platf);
                        ObjectsToRemove.Add(joint);
                        ObjectsToRemove.Add(leftBorder);
                        ObjectsToRemove.Add(rightBorder);
                        pl.Equipment.Clear();
                        pl.Armor.SetId(0);
                        pl.Revive(100, false, true, x, y);
                        player.AddExp(5, 5);
                    }
                }
            }
Exemplo n.º 7
0
            public TShieldGenerator(int power, Vector2 position, float radius, PlayerTeam team)
            {
                Team       = team;
                Power      = power;
                Radius     = radius;
                CoreObject = GlobalGame.CreateObject("Computer00", position, 0);
                TextName   = (IObjectText)GlobalGame.CreateObject("Text", position);
                TextName.SetTextAlignment(TextAlignment.Middle);
                TextName.SetTextScale(0.8f);
                IObject          leftLeg  = GlobalGame.CreateObject("Duct00C_D", position + new Vector2(-5, -2), (float)Math.PI / 2);
                IObject          rightLeg = GlobalGame.CreateObject("Duct00C_D", position + new Vector2(6, -2), (float)Math.PI / 2);
                IObjectWeldJoint joint    = (IObjectWeldJoint)GlobalGame.CreateObject("WeldJoint", position);

                joint.AddTargetObject(CoreObject);
                joint.AddTargetObject(leftLeg);
                joint.AddTargetObject(rightLeg);
                OtherObjects.Add(leftLeg);
                OtherObjects.Add(rightLeg);
                OtherObjects.Add(joint);
                OtherObjects.Add(TextName);
            }
Exemplo n.º 8
0
            public void OnDestroyed()
            {
                IsDestroyed = true;
                if (Id == 1)
                {
                    GlobalGame.SpawnFireNodes(Position, 50, new Vector2(0, 0), 3, 10, FireNodeType.Flamethrower);
                }
                if (Id == 0 || Id == 1)
                {
                    ReadyForRemove = true;
                }

                if (Id == 3)
                {
                    FlashbangExplosion();
                }

                if (Id == 2)
                {
                    ThrownWeaponObject = GlobalGame.CreateObject("DrinkingGlass00", Position);
                }
            }
Exemplo n.º 9
0
 public TThrownWeapon(IObject obj, int id)
 {
     Id = id;
     if (Id == 2 || Id == 3)
     {
         ThrownWeaponObject = GlobalGame.CreateObject("DrinkingGlass00", obj.GetWorldPosition(), obj.GetAngle(), obj.GetLinearVelocity(), obj.GetAngularVelocity());
         ObjectsToRemove.Add(ThrownWeaponObject);
         obj.Remove();
     }
     else
     {
         ThrownWeaponObject = obj;
     }
     Position = ThrownWeaponObject.GetWorldPosition();
     if (Id == 2 || Id == 3)
     {
         TicksUntilExplosion = 100;
     }
     if (Id == 2)
     {
         SmokeCount = 400;
     }
 }
Exemplo n.º 10
0
 public void OnFire(TPlayer player, WeaponItemType type)
 {
     if (CanOverheat)
     {
         Overheating += ShotHeat;
         if (Overheating >= 100)
         {
             player.User.GetPlayer().RemoveWeaponItemType(type);
             GlobalGame.PlayEffect("CFTXT", player.Position, "OVERHEATED");
             GlobalGame.PlayEffect("EXP", player.Position);
             player.Hp      -= 50;
             player.Bleeding = true;
             Vector2 pos = player.Position;
             GlobalGame.CreateObject("MetalDebris00A", pos, (float)rnd.NextDouble());
             pos.X += 5;
             GlobalGame.CreateObject("MetalDebris00B", pos, (float)rnd.NextDouble());
             pos.X -= 10;
             GlobalGame.CreateObject("MetalDebris00C", pos, (float)rnd.NextDouble());
         }
         else
         {
             GlobalGame.PlayEffect("CFTXT", player.Position, "OVERHEATING " + ((int)Overheating).ToString() + "%");
         }
     }
     if (DNAProtection && player.Team != TeamDNA)
     {
         player.User.GetPlayer().RemoveWeaponItemType(type);
         GlobalGame.PlayEffect("CFTXT", player.Position, "DNA SCAN ERROR");
         GlobalGame.TriggerExplosion(player.Position);
         DNAProtection = false;
     }
     if (type == WeaponItemType.Thrown)
     {
         CreateThrownWeapon(Weapon, CustomId, player.Position);
     }
 }
Exemplo n.º 11
0
            public void UpdatePoliceShield(TPlayer player)
            {
                IPlayer pl = player.User.GetPlayer();

                if (pl == null)
                {
                    return;
                }
                Vector2 pos       = pl.GetWorldPosition();
                int     dir       = pl.FacingDirection;
                Vector2 shieldPos = pos + new Vector2(10 * dir, 4);
                Area    area      = new Area(shieldPos.Y + 4, shieldPos.X - 2, shieldPos.Y, shieldPos.X);

                if (ObjectList.Count > 0)
                {
                    float damageFactor = 0.125f;
                    if (!CheckAreaToCollision(area))
                    {
                        ObjectList[0].SetWorldPosition(pos + new Vector2(10 * dir, 4));
                        ObjectList[1].SetWorldPosition(pos + new Vector2(8 * dir, 17));
                        ObjectList[1].SetAngle(0.3f * dir);
                    }
                    float ch = (OtherData[0] - ObjectList[0].GetHealth()) * damageFactor;
                    OtherData[1] -= ch;
                    ObjectList[0].SetHealth(OtherData[0]);
                    ch            = (OtherData[2] - ObjectList[1].GetHealth()) * damageFactor;
                    OtherData[3] -= ch;
                    ObjectList[1].SetHealth(OtherData[2]);
                    if (ObjectList[0].DestructionInitiated || OtherData[1] <= 0 || ObjectList[1].DestructionInitiated || OtherData[3] <= 0)
                    {
                        ObjectList[0].Destroy();
                        ObjectList[1].Destroy();
                        MinusAmmo();
                        ObjectList.Clear();
                        return;
                    }
                }
                if (!pl.IsDead && pl.FacingDirection == OtherData[4] && !pl.IsManualAiming && !pl.IsHipFiring && !pl.IsClimbing && !pl.IsDiving && !pl.IsRolling && !pl.IsStaggering && !pl.IsTakingCover && !pl.IsInMidAir && !pl.IsLayingOnGround && !pl.IsLedgeGrabbing && !pl.IsMeleeAttacking && pl.IsWalking)
                {
                    if (ObjectList.Count == 0 && !CheckAreaToCollision(area))
                    {
                        IObject shield = GlobalGame.CreateObject("MetalRailing00", pos + new Vector2(10 * dir, 4));
                        ObjectList.Add(shield);
                        shield = GlobalGame.CreateObject("MetalRailing00", pos + new Vector2(8 * dir, 17), 0.3f * dir);
                        ObjectList.Add(shield);
                    }
                }
                else
                {
                    if (pl.FacingDirection != OtherData[4])
                    {
                        OtherData[4]  = pl.FacingDirection;
                        FastReloading = 10;
                    }
                    if (ObjectList.Count > 0)
                    {
                        ObjectList[0].Remove();
                        ObjectList[1].Remove();
                        ObjectList.Clear();
                    }
                }
            }
Exemplo n.º 12
0
            public TTurret(int id, Vector2 position, int dir, PlayerTeam team)
            {
                Id   = id;
                Team = team;
                if (dir < 0)
                {
                    MainBlockAngle = (float)Math.PI / 2;
                    DefaultAngle   = (float)Math.PI;
                }
                else
                {
                    MainBlockAngle = (float)Math.PI / 2;
                    DefaultAngle   = 0;
                }
                IObject leftLeg  = null;
                IObject rightLeg = null;
                IObject hull2    = null;
                IObject hull3    = null;
                IObject hull4    = null;

                if (Id < 4)
                {
                    leftLeg  = GlobalGame.CreateObject("Duct00C_D", position + new Vector2(-3, -9), 1.2f);
                    rightLeg = GlobalGame.CreateObject("Duct00C_D", position + new Vector2(3, -9), -1.2f);
                    leftLeg.SetMass(leftLeg.GetMass() * 20);
                    rightLeg.SetMass(rightLeg.GetMass() * 20);
                }
                else if (Id == 4 || Id == 5 || Id == 6 || Id == 7)
                {
                    RotationLimit = 0;
                    Hull          = GlobalGame.CreateObject("BgMetal08H", position + new Vector2(-4, 4), (float)Math.PI / 2);
                    hull2         = GlobalGame.CreateObject("BgMetal08H", position + new Vector2(4, 4), 0);
                    hull3         = GlobalGame.CreateObject("BgMetal08H", position + new Vector2(4, -4), -(float)Math.PI / 2);
                    hull4         = GlobalGame.CreateObject("BgMetal08H", position + new Vector2(-4, -4), -(float)Math.PI);
                    hull2.SetBodyType(BodyType.Dynamic);
                    hull3.SetBodyType(BodyType.Dynamic);
                    hull4.SetBodyType(BodyType.Dynamic);
                }
                else if (Id == 6 || Id == 7)
                {
                    RotationLimit = 0;
                    Hull          = GlobalGame.CreateObject("BgMetal08H", position + new Vector2(-4, 4), (float)Math.PI / 2);
                    hull2         = GlobalGame.CreateObject("BgMetal08H", position + new Vector2(4, 4), 0);
                    hull3         = GlobalGame.CreateObject("BgMetal08H", position + new Vector2(4, -4), -(float)Math.PI / 2);
                    hull4         = GlobalGame.CreateObject("BgMetal08H", position + new Vector2(-4, -4), -(float)Math.PI);
                    hull2.SetBodyType(BodyType.Dynamic);
                    hull3.SetBodyType(BodyType.Dynamic);
                    hull4.SetBodyType(BodyType.Dynamic);
                }


                if (Id == 6 || Id == 7)
                {
                    MainBlock = GlobalGame.CreateObject("CrabCan00", position, -(float)Math.PI / 2 * dir);
                }
                else
                {
                    MainBlock = GlobalGame.CreateObject("Computer00", position, -(float)Math.PI / 2 * dir);
                }

                MainBlock.SetHealth(1000);

                if (Id >= 4)
                {
                    IObjectAlterCollisionTile collisionDisabler = (IObjectAlterCollisionTile)GlobalGame.CreateObject("AlterCollisionTile", position);
                    collisionDisabler.SetDisableCollisionTargetObjects(true);
                    collisionDisabler.SetDisableProjectileHit(false);
                    collisionDisabler.AddTargetObject(MainBlock);
                    IObject[] platforms = GlobalGame.GetObjectsByName(new string[] { "MetalPlat01A", "Lift00C", "Lift00B", "MetalPlat00G", "Elevator02B", "InvisiblePlatform", "MetalPlat01F" });
                    for (int i = 0; i < platforms.Length; ++i)
                    {
                        collisionDisabler.AddTargetObject(platforms[i]);
                    }
                }
                IObject antenna = GlobalGame.CreateObject("BgAntenna00B", position + new Vector2(-2 * dir, 9));

                antenna.SetBodyType(BodyType.Dynamic);
                antenna.SetMass(0.0000001f);
                IObjectWeldJoint bodyJoint = (IObjectWeldJoint)GlobalGame.CreateObject("WeldJoint", position);
                IObjectWeldJoint hullJoint = (IObjectWeldJoint)GlobalGame.CreateObject("WeldJoint", position);

                if (Id < 4)
                {
                    hullJoint.AddTargetObject(leftLeg);
                    hullJoint.AddTargetObject(rightLeg);
                    OtherObjects.Add(leftLeg);
                    OtherObjects.Add(rightLeg);
                }
                else if (Id == 4 || Id == 5 || Id == 6 || Id == 7)
                {
                    hullJoint.AddTargetObject(Hull);
                    hullJoint.AddTargetObject(hull2);
                    hullJoint.AddTargetObject(hull3);
                    hullJoint.AddTargetObject(hull4);
                    OtherObjects.Add(Hull);
                    OtherObjects.Add(hull2);
                    OtherObjects.Add(hull3);
                    OtherObjects.Add(hull4);
                }
                bodyJoint.AddTargetObject(MainBlock);
                bodyJoint.AddTargetObject(antenna);
                bodyJoint.SetPlatformCollision(WeldJointPlatformCollision.PerObject);
                OtherObjects.Add(antenna);
                OtherObjects.Add(bodyJoint);
                OtherObjects.Add(hullJoint);
                DamagedObjects.Add(MainBlock);
                if (Id == 4 || Id == 5)
                {
                    HackingProtection = true;
                    EnableMovement    = true;
                    PathSize          = 2;
                    Speed             = 3;
                    RotationSpeed     = 3f;
                    DamageFactor      = 1f;
                    DroneMinDistance  = 5 * 8;
                }
                else if (Id == 6)
                {
                    HackingProtection = false;
                    EnableMovement    = true;
                    PathSize          = 2;
                    Speed             = 4;
                    RotationSpeed     = 2f;
                    DamageFactor      = 1.5f;
                    DroneMinDistance  = 4 * 8;
                }
                else if (Id == 7)
                {
                    HackingProtection = false;
                    EnableMovement    = true;
                    PathSize          = 2;
                    Speed             = 4;
                    RotationSpeed     = 2f;
                    DamageFactor      = 1f;
                    DroneMinDistance  = 4 * 8;
                }

                if (id == 0)
                {
                    Name = "Light Turret";
                }
                else if (id == 1)
                {
                    Name = "Rocket Turret";
                }
                else if (id == 2)
                {
                    Name = "Heavy Turret";
                }
                else if (id == 3)
                {
                    Name = "Sniper Turret";
                }
                else if (id == 4)
                {
                    Name = "Assault Drone";
                }
                else if (id == 5)
                {
                    Name = "Fire Drone";
                }
                else if (id == 6)
                {
                    Name = "Tazer Drone";
                }
                else if (id == 7)
                {
                    Name = "Melee Drone";
                }
                if (id == 1 || id == 2)
                { //@0:5B=8F0
                    IObject gun2 = GlobalGame.CreateObject("BgBarberPole00", position + new Vector2(dir, -2), (float)Math.PI / 2);
                    IObject gun1 = GlobalGame.CreateObject("BgBarberPole00", position + new Vector2(dir, 3), (float)Math.PI / 2);
                    gun1.SetBodyType(BodyType.Dynamic);
                    gun2.SetBodyType(BodyType.Dynamic);
                    gun1.SetMass(0.0000001f);
                    gun2.SetMass(0.0000001f);
                    bodyJoint.AddTargetObject(gun1);
                    bodyJoint.AddTargetObject(gun2);
                    OtherObjects.Add(gun1);
                    OtherObjects.Add(gun2);
                    TTurretWeapon weapon = new TTurretWeapon
                    {
                        BulletType    = (int)ProjectileItem.BAZOOKA,
                        Sound         = "Bazooka",
                        ReloadingTime = 200
                    };
                    if (id == 2)
                    {
                        weapon.Ammo = 4;
                    }
                    else
                    {
                        weapon.Ammo            = 6;
                        weapon.SuppressiveFire = true;
                        weapon.MaxFireDelay    = 1;
                        weapon.MaxBulletCount  = 1;
                    }
                    weapon.Scatter = 0;
                    WeaponList.Add(weapon);
                }
                if (id == 0 || id == 2 || id == 4)
                { //?C;5<5B
                    IObject gun00 = GlobalGame.CreateObject("BgPipe02A", position + new Vector2(8 * dir, 0));
                    IObject gun01 = GlobalGame.CreateObject("BgPipe02B", position + new Vector2(14 * dir, 0));
                    IObject gun10 = GlobalGame.CreateObject("BgPipe02A", position + new Vector2(8 * dir, 2));
                    IObject gun11 = GlobalGame.CreateObject("BgPipe02B", position + new Vector2(14 * dir, 2));
                    gun00.SetBodyType(BodyType.Dynamic);
                    gun01.SetBodyType(BodyType.Dynamic);
                    gun10.SetBodyType(BodyType.Dynamic);
                    gun11.SetBodyType(BodyType.Dynamic);
                    gun00.SetMass(0.0000001f);
                    gun01.SetMass(0.0000001f);
                    gun10.SetMass(0.0000001f);
                    gun11.SetMass(0.0000001f);
                    bodyJoint.AddTargetObject(gun00);
                    bodyJoint.AddTargetObject(gun01);
                    bodyJoint.AddTargetObject(gun10);
                    bodyJoint.AddTargetObject(gun11);
                    OtherObjects.Add(gun00);
                    OtherObjects.Add(gun01);
                    OtherObjects.Add(gun10);
                    OtherObjects.Add(gun11);
                    TTurretWeapon weapon = new TTurretWeapon
                    {
                        BulletType      = (int)ProjectileItem.UZI,
                        Sound           = "AssaultRifle",
                        ReloadingTime   = 7,
                        Ammo            = 150,
                        Scatter         = 2,
                        SuppressiveFire = true,
                        MaxFireDelay    = 30,
                        MaxBulletCount  = 3
                    };
                    WeaponList.Add(weapon);
                }
                if (id == 3)
                { //A=09?5@:0
                    IObject gun1 = GlobalGame.CreateObject("BgPipe02A", position + new Vector2((dir == -1) ? -14 : 6, 0));
                    IObject gun2 = GlobalGame.CreateObject("BgPipe02B", position + new Vector2(22 * dir, 0));
                    IObject gun3 = GlobalGame.CreateObject("BgPipe02B", position + new Vector2(7 * dir, 2));
                    gun1.SetSizeFactor(new Point(2, 1));
                    gun1.SetBodyType(BodyType.Dynamic);
                    gun2.SetBodyType(BodyType.Dynamic);
                    gun3.SetBodyType(BodyType.Dynamic);
                    gun1.SetMass(0.0000001f);
                    gun2.SetMass(0.0000001f);
                    gun3.SetMass(0.0000001f);
                    bodyJoint.AddTargetObject(gun1);
                    bodyJoint.AddTargetObject(gun2);
                    bodyJoint.AddTargetObject(gun3);
                    OtherObjects.Add(gun1);
                    OtherObjects.Add(gun2);
                    OtherObjects.Add(gun3);
                    TTurretWeapon weapon = new TTurretWeapon
                    {
                        BulletType    = (int)ProjectileItem.SNIPER,
                        Sound         = "Sniper",
                        ReloadingTime = 150,
                        Ammo          = 10,
                        Scatter       = 0
                    };
                    WeaponList.Add(weapon);
                }
                if (id == 5)
                { //>3=5<QB
                    IObject gun1 = GlobalGame.CreateObject("BgPipe02A", position + new Vector2((dir == -1) ? -14 : 6, 0));
                    IObject gun2 = GlobalGame.CreateObject("BgPipe02B", position + new Vector2(14 * dir, 0));
                    IObject gun3 = GlobalGame.CreateObject("BgPipe02B", position + new Vector2(7 * dir, 2));
                    IObject gun4 = GlobalGame.CreateObject("BgPipe02B", position + new Vector2(7 * dir, -2));
                    gun1.SetBodyType(BodyType.Dynamic);
                    gun2.SetBodyType(BodyType.Dynamic);
                    gun3.SetBodyType(BodyType.Dynamic);
                    gun4.SetBodyType(BodyType.Dynamic);
                    gun1.SetMass(0.0000001f);
                    gun2.SetMass(0.0000001f);
                    gun3.SetMass(0.0000001f);
                    gun4.SetMass(0.0000001f);
                    bodyJoint.AddTargetObject(gun1);
                    bodyJoint.AddTargetObject(gun2);
                    bodyJoint.AddTargetObject(gun3);
                    bodyJoint.AddTargetObject(gun4);
                    OtherObjects.Add(gun1);
                    OtherObjects.Add(gun2);
                    OtherObjects.Add(gun3);
                    OtherObjects.Add(gun4);
                    TTurretWeapon weapon = new TTurretWeapon
                    {
                        Distance        = 150,
                        BulletType      = -1,
                        Sound           = "Flamethrower",
                        ReloadingTime   = 3,
                        Ammo            = 300,
                        SuppressiveFire = true,
                        Scatter         = 10,
                        TurretTarget    = false
                    };
                    WeaponList.Add(weapon);
                }
                if (Id == 6)
                {
                    TTurretWeapon weapon = new TTurretWeapon
                    {
                        Distance        = 50,
                        BulletType      = -2,
                        Sound           = "Splash",
                        ReloadingTime   = 150,
                        SuppressiveFire = true,
                        Ammo            = 25,
                        TurretTarget    = false
                    };
                    WeaponList.Add(weapon);
                }
                if (Id == 7)
                {
                    TTurretWeapon weapon = new TTurretWeapon
                    {
                        Distance        = 60,
                        BulletType      = -3,
                        Sound           = "MeleeSwing",
                        ReloadingTime   = 50,
                        SuppressiveFire = true,
                        Ammo            = 15,
                        TurretTarget    = false
                    };
                    WeaponList.Add(weapon);
                }
                TextName = (IObjectText)GlobalGame.CreateObject("Text", position);
                TextName.SetTextAlignment(TextAlignment.Middle);
                TextName.SetText(Name);
                TextName.SetTextScale(0.8f);
                OtherObjects.Add(TextName);
                MainMotor = (IObjectRevoluteJoint)GlobalGame.CreateObject("RevoluteJoint", position);
                MainMotor.SetTargetObjectB(MainBlock);
                if (Id < 4)
                {
                    MainMotor.SetTargetObjectA(leftLeg);
                }
                else
                {
                    MainMotor.SetTargetObjectA(hull2);
                }
                MainMotor.SetMotorEnabled(true);
                MainMotor.SetMaxMotorTorque(100000);
                MainMotor.SetMotorSpeed(0);
                OtherObjects.Add(MainMotor);
                InitHealth();
            }
Exemplo n.º 13
0
 public void Update()
 {
     NeedPower = 0;
     if (CheckShieldTimer == 0)
     {
         bool d = false;
         for (int i = 0; i < PlayerList.Count; i++)
         {
             if (PlayerList[i].Team == Team)
             {
                 IPlayer pl = PlayerList[i].User.GetPlayer();
                 if (pl == null)
                 {
                     continue;
                 }
                 if (TestDistance(Position, PlayerList[i].Position, 28))
                 {
                     d = true;
                     break;
                 }
             }
         }
         if (d && !Disabled)
         {
             Remove();
             NeedPower = -2;
         }
         Disabled         = d;
         CheckShieldTimer = 30;
     }
     else if (CheckShieldTimer > 0)
     {
         CheckShieldTimer--;
     }
     if (Disabled)
     {
         return;
     }
     if (ShieldBlock == null || ShieldBlock.IsRemoved)
     {
         ShieldBlock = GlobalGame.CreateObject("InvisibleBlock", Position + new Vector2(NCos * 4, NSin * 4), Angle);
         ShieldBlock.SetSizeFactor(new Point(1, 2));
     }
     for (int i = 0; i < ShieldGlass.Count; i++)
     {
         if (ShieldGlass[i] == null)
         {
             int s = (int)Math.Pow(-1, i);
             ShieldGlass[i] = GlobalGame.CreateObject("ReinforcedGlass00A", Position + new Vector2(NCos * 4 * s, NSin * 4 * s) - new Vector2(Cos, Sin), Angle);
         }
         else if (ShieldGlass[i].IsRemoved)
         {
             ShieldGlass[i].Remove();
             ShieldGlass[i] = null;
         }
     }
     for (int i = 0; i < ShieldShard.Count; i++)
     {
         int s = (int)Math.Pow(-1, i);
         if (ShieldShard[i] == null)
         {
             ShieldShard[i] = GlobalGame.CreateObject("GlassShard00A", Position + new Vector2(NCos * 4 * s, NSin * 4 * s) + new Vector2(Cos * 4, Sin * 4), Angle - (float)Math.PI / 2);
             ShieldShard[i].SetBodyType(BodyType.Static);
         }
         else if (ShieldShard[i].IsRemoved)
         {
             ShieldShard[i].Remove();
             ShieldShard[i] = null;
             NeedPower++;
         }
     }
     if (NeedPower > 0)
     {
         int offset = GlobalRandom.Next(-8, 8);
         GlobalGame.PlayEffect("S_P", Position + new Vector2(Cos * offset, Sin * offset));
     }
     if (AnimationTime <= 0)
     {
         AnimationTime = GlobalRandom.Next(50, 150);
         int offset = GlobalRandom.Next(-8, 8);
         GlobalGame.PlayEffect("GLM", Position + new Vector2(Cos * offset, Sin * offset));
     }
     else if (AnimationTime > 0)
     {
         AnimationTime--;
     }
 }