Example #1
0
        protected override bool OnDestroy(DestroyType type = null)
        {
            this._hitPoints = 0.0f;
            Level.Remove((Thing)this);
            SFX.Play("crateDestroy");
            Vec2 vec2 = Vec2.Zero;

            if (type is DTShot)
            {
                vec2 = (type as DTShot).bullet.travelDirNormalized;
            }
            for (int index = 0; index < 6; ++index)
            {
                Thing thing = (Thing)WoodDebris.New(this.x - 8f + Rando.Float(16f), this.y - 8f + Rando.Float(16f));
                thing.hSpeed = (float)(((double)Rando.Float(1f) > 0.5 ? 1.0 : -1.0) * (double)Rando.Float(3f) + (double)Math.Sign(vec2.x) * 0.5);
                thing.vSpeed = -Rando.Float(1f);
                Level.Add(thing);
            }
            for (int index = 0; index < 5; ++index)
            {
                SmallSmoke smallSmoke = SmallSmoke.New(this.x + Rando.Float(-6f, 6f), this.y + Rando.Float(-6f, 6f));
                smallSmoke.hSpeed += Rando.Float(-0.3f, 0.3f);
                smallSmoke.vSpeed -= Rando.Float(0.1f, 0.2f);
                Level.Add((Thing)smallSmoke);
            }
            return(true);
        }
Example #2
0
        protected override bool OnDestroy(DestroyType type = null)
        {
            this._hitPoints = 0.0f;
            Level.Remove((Thing)this);
            SFX.Play("glassHit");
            Vec2 hitAngle = Vec2.Zero;

            if (type is DTShot)
            {
                hitAngle = (type as DTShot).bullet.travelDirNormalized;
            }
            for (int index = 0; index < 8; ++index)
            {
                Thing thing = (Thing) new GlassParticle(this.x + Rando.Float(-4f, 4f), this.y + Rando.Float(-4f, 4f), hitAngle);
                Level.Add(thing);
                thing.hSpeed = (float)((double)hitAngle.x * 2.0 * ((double)Rando.Float(1f) + 0.300000011920929));
                thing.vSpeed = (float)((double)hitAngle.y * 2.0 * ((double)Rando.Float(1f) + 0.300000011920929)) - Rando.Float(2f);
                Level.Add(thing);
            }
            for (int index = 0; index < 5; ++index)
            {
                SmallSmoke smallSmoke = SmallSmoke.New(this.x + Rando.Float(-6f, 6f), this.y + Rando.Float(-6f, 6f));
                smallSmoke.hSpeed += Rando.Float(-0.3f, 0.3f);
                smallSmoke.vSpeed -= Rando.Float(0.1f, 0.2f);
                Level.Add((Thing)smallSmoke);
            }
            return(true);
        }
Example #3
0
        // Token: 0x0600254F RID: 9551
        protected bool OnDestroybam(DestroyType type = null)
        {
            if (!base.isServerForObject)
            {
                return(false);
            }
            ATRCShrapnel shrap = new ATRCShrapnel();

            shrap.MakeNetEffect(this.position, false);
            List <Bullet> firedBullets = new List <Bullet>();

            for (int i = 0; i < 20; i++)
            {
                float dir = (float)i * 18f - 5f + Rando.Float(10f);
                shrap       = new ATRCShrapnel();
                shrap.range = 55f + Rando.Float(14f);
                Bullet bullet = new Bullet(base.x + (float)(Math.Cos((double)Maths.DegToRad(dir)) * 6.0), base.y - (float)(Math.Sin((double)Maths.DegToRad(dir)) * 6.0), shrap, dir, null, false, -1f, false, true);
                bullet.firedFrom = this;
                firedBullets.Add(bullet);
                Level.Add(bullet);
            }
            if (Network.isActive)
            {
                Send.Message(new NMFireGun(null, firedBullets, 0, false, 4, false), NetMessagePriority.ReliableOrdered, null);
                firedBullets.Clear();
            }
            Level.Remove(this);
            return(true);
        }
Example #4
0
 protected override bool OnDestroy(DestroyType type = null)
 {
     if (this._duckOwner == null)
     {
         return(false);
     }
     if (!this.destroyed)
     {
         this._duckOwner.hSpeed = this.hSpeed;
         bool wasKilled = type != null;
         if (!wasKilled && this.jumpCountdown > 0.01f)
         {
             this._duckOwner.vSpeed = Duck.JumpSpeed;
         }
         else
         {
             this._duckOwner.vSpeed = (wasKilled ? (this.vSpeed - 1f) : -3f);
         }
         this._duckOwner.x = base.x;
         this._duckOwner.y = base.y - 10f;
         for (int i = 0; i < 4; i++)
         {
             SmallSmoke s = SmallSmoke.New(base.x + Rando.Float(-4f, 4f), base.y + Rando.Float(-4f, 4f));
             s.hSpeed += this.hSpeed * Rando.Float(0.3f, 0.5f);
             s.vSpeed -= Rando.Float(0.1f, 0.2f);
             Level.Add(s);
         }
         if (this.owner != null)
         {
             Duck d = this.owner as Duck;
             if (d != null)
             {
                 d.holdObject = null;
             }
         }
         if (Network.isActive)
         {
             if (!wasKilled)
             {
                 this._duckOwner.Fondle(this);
                 this.authority += 45;
             }
             this.active  = false;
             this.visible = false;
             this.owner   = null;
         }
         else
         {
             Level.Remove(this);
         }
         if (wasKilled && !this._duckOwner.killingNet)
         {
             this._duckOwner.killingNet = true;
             this._duckOwner.Destroy(type);
         }
         this._duckOwner._trapped = null;
     }
     return(true);
 }
Example #5
0
 protected override bool OnDestroy(DestroyType type = null)
 {
     if (this._pin)
     {
         return(false);
     }
     this.BlowUp();
     return(true);
 }
 protected override bool OnDestroy(DestroyType type = null)
 {
     if (this.isServerForObject)
     {
         for (int index = 0; index < this._numFlames; ++index)
         {
             Level.Add((Thing)SmallFire.New(this.x - this.hSpeed, this.y - this.vSpeed, Rando.Float(6f) - 3f, Rando.Float(6f) - 3f, firedFrom: ((Thing)this)));
         }
     }
     SFX.Play("flameExplode", 0.9f, Rando.Float(0.2f) - 0.1f);
     Level.Remove((Thing)this);
     return(true);
 }
Example #7
0
 protected override void OnStart()
 {
     Options.Initialize();
     Global.Initialize();
     Teams.Initialize();
     DuckRig.Initialize();
     Unlocks.Initialize();
     ConnectionStatusUI.Initialize();
     Unlocks.CalculateTreeValues();
     Profiles.Initialize();
     Dialogue.Initialize();
     DuckTitle.Initialize();
     News.Initialize();
     Script.Initialize();
     DuckNews.Initialize();
     VirtualBackground.InitializeBack();
     AmmoType.InitializeTypes();
     DestroyType.InitializeTypes();
     VirtualTransition.Initialize();
     Unlockables.Initialize();
     UIInviteMenu.Initialize();
     LevelGenerator.Initialize();
     DuckFile.CompleteSteamCloudInitializate();
     Main.ResetMatchStuff();
     foreach (Profile profile in Profiles.active)
     {
         profile.RecordPreviousStats();
     }
     Main.editor = new DuckGameEditor();
     foreach (string file in DuckFile.GetFiles(Directory.GetCurrentDirectory(), "*.hat"))
     {
         Team t = Team.Deserialize(file);
         if (t != null)
         {
             Teams.AddExtraTeam(t);
         }
     }
     Main.SetPurchaseDetails(9.99f, "USD");
     if (Main.connectID != 0UL)
     {
         NCSteam.inviteLobbyID = Main.connectID;
         Level.current         = (Level) new JoinServer(Main.connectID);
     }
     else
     {
         Level.current = !MonoMain.noIntro ? (Level) new BIOSScreen() : (!MonoMain.startInEditor ? (Level) new TitleScreen() : (Level)Main.editor);
     }
     this._font = new BitmapFont("biosFont", 8);
     Highlights.StartRound();
 }
Example #8
0
 public override bool Kill(DestroyType type = null)
 {
     if (this._up && this._popup)
     {
         if (ChallengeLevel.running)
         {
             ++ChallengeLevel.targetsShot;
         }
         if (this.holdObject is Gun && !(bool)this.dropgun)
         {
             (this.holdObject as Gun).ammo = 0;
         }
         this.ThrowItem(false);
         foreach (Equipment equipment in this._equipment)
         {
             if (equipment != null)
             {
                 equipment.owner  = (Thing)null;
                 equipment.hSpeed = Rando.Float(2f) - 1f;
                 equipment.vSpeed = -Rando.Float(1.5f);
                 this.ReturnItemToWorld((Thing)equipment);
                 equipment.UnEquip();
             }
         }
         SFX.Play("ting", Rando.Float(0.7f, 0.8f), Rando.Float(-0.2f, 0.2f));
         if (type is DTShot)
         {
             SFX.Play("targetRebound", Rando.Float(0.7f, 0.8f), Rando.Float(-0.2f, 0.2f));
         }
         Vec2 vec2 = Vec2.Zero;
         if (type is DTShot)
         {
             vec2 = (type as DTShot).bullet.travelDirNormalized;
         }
         for (int index = 0; index < 4; ++index)
         {
             Thing thing = (Thing)WoodDebris.New(this.x - 8f + Rando.Float(16f), this.y - 20f + Rando.Float(16f));
             thing.hSpeed = (float)(((double)Rando.Float(1f) > 0.5 ? 1.0 : -1.0) * (double)Rando.Float(3f) + (double)Math.Sign(vec2.x) * 0.5);
             thing.vSpeed = -Rando.Float(1f);
             Level.Add(thing);
         }
         for (int index = 0; index < 2; ++index)
         {
             Level.Add((Thing)Feather.New(this.x, this.y - 16f, this.persona));
         }
         this.PopDown();
     }
     return(false);
 }
Example #9
0
 protected override bool OnDestroy(DestroyType type = null)
 {
     if (type.thing != null && type.thing is Duck || this._ruined)
     {
         return(false);
     }
     this._ruined = true;
     this.graphic = this._damaged;
     SFX.Play("breakTV");
     for (int index = 0; index < 8; ++index)
     {
         Level.Add((Thing) new GlassParticle(this.x + Rando.Float(-8f, 8f), this.y + Rando.Float(-8f, 8f), new Vec2(Rando.Float(-1f, 1f), Rando.Float(-1f, 1f))));
     }
     this.collideSounds.Clear();
     this.collideSounds.Add("deadTVLand");
     return(false);
 }
Example #10
0
 protected override bool OnDestroy(DestroyType type = null)
 {
     this._hitPoints = 0.0f;
     for (int index = 0; index < 6; ++index)
     {
         Level.Add((Thing) new GlassParticle(this.x - 8f + Rando.Float(16f), this.y - 8f + Rando.Float(16f), new Vec2(Rando.Float(-2f, 2f), Rando.Float(-2f, 2f))));
     }
     for (int index = 0; index < 5; ++index)
     {
         SmallSmoke smallSmoke = SmallSmoke.New(this.x + Rando.Float(-6f, 6f), this.y + Rando.Float(-6f, 6f));
         smallSmoke.hSpeed += Rando.Float(-0.3f, 0.3f);
         smallSmoke.vSpeed -= Rando.Float(0.1f, 0.2f);
         Level.Add((Thing)smallSmoke);
     }
     SFX.Play("crateDestroy");
     Level.Remove((Thing)this);
     return(true);
 }
Example #11
0
        // Token: 0x06001988 RID: 6536
        protected override bool OnDestroy(DestroyType type = null)
        {
            if (!base.isServerForObject)
            {
                return(false);
            }
            ATRCShrapnel atrcshrapnel = new ATRCShrapnel();

            atrcshrapnel.MakeNetEffect(this.position, false);
            List <Bullet> list = new List <Bullet>();

            for (int i = 0; i < 20; i++)
            {
                float num = (float)i * 18f - 5f + Rando.Float(10f);
                atrcshrapnel       = new ATRCShrapnel();
                atrcshrapnel.range = 55f + Rando.Float(14f);
                Bullet bullet = new Bullet(base.x + (float)(Math.Cos((double)Maths.DegToRad(num)) * 6.0), base.y - (float)(Math.Sin((double)Maths.DegToRad(num)) * 6.0), atrcshrapnel, num, null, false, -1f, false, true);
                bullet.firedFrom = this;
                list.Add(bullet);
                Level.Add(bullet);
            }
            if (Network.isActive)
            {
                Send.Message(new NMFireGun(null, list, 0, false, 4, false), NetMessagePriority.ReliableOrdered, null);
                list.Clear();
            }
            Level.Remove(this);
            FollowCam followCam = Level.current.camera as FollowCam;

            if (followCam != null)
            {
                followCam.Remove(this);
            }
            if (Recorder.currentRecording != null)
            {
                Recorder.currentRecording.LogBonus();
            }
            return(true);
        }
 protected override bool OnDestroy(DestroyType type = null) => true;