예제 #1
0
 public Pedestal(float xpos, float ypos, Team team, int place)
     : base(xpos, ypos)
 {
     this._team         = team;
     this._sprite       = new SpriteMap("rockThrow/placePedastals", 38, 45);
     this._sprite.frame = place;
     this.center        = new Vec2((float)(this._sprite.w / 2), (float)this._sprite.h);
     this.graphic       = (Sprite)this._sprite;
     this.depth         = new Depth(0.062f);
     this._scoreCard    = new Sprite("rockThrow/scoreCard");
     this._font         = new BitmapFont("biosFont", 8);
     this._scoreCard.CenterOrigin();
     this._trophy = new Sprite("trophy");
     this._trophy.CenterOrigin();
     if (Network.isServer)
     {
         int num1 = 0;
         foreach (Profile activeProfile in team.activeProfiles)
         {
             float num2 = (float)((team.activeProfiles.Count - 1) * 10);
             Duck  duck = new Duck(xpos - num2 / 2f + (float)(num1 * 10), this.GetYOffset() - 15f, activeProfile);
             duck.depth = new Depth(0.06f);
             Level.Add((Thing)duck);
             if (place == 0)
             {
                 Trophy trophy = new Trophy(duck.x, duck.y);
                 Level.Add((Thing)trophy);
                 if (!Network.isActive)
                 {
                     duck.Fondle((Thing)trophy);
                     duck.GiveHoldable((Holdable)trophy);
                 }
             }
             ++num1;
         }
     }
     Level.Add((Thing) new Platform(xpos - 17f, this.GetYOffset(), 34f, 16f));
     Level.Add((Thing) new Block(-6f, this.GetYOffset() - 100f, 6f, 200f));
     Level.Add((Thing) new Block(320f, this.GetYOffset() - 100f, 6f, 200f));
     Level.Add((Thing) new Block(-20f, 155f, 600f, 100f));
 }
예제 #2
0
        public void ReplaceHat(TeamHat teamHat, TeamHat newHat)
        {
            if (teamHat == null ||
                teamSpawnsDone.ContainsKey(teamHat) ||
                Level.current == null
                )
            {
                //|| !(Level.current is GameLevel
                //|| Level.current is Editor
                // || Level.current is TeamSelect2))
                //throw new Exception("DUCKZ!" + Level.current.ToString());
                return;
            }

            //throw new Exception("Attempted to replace a hat! " + teamHat.team.hat.texture.textureName);

            if (teamHat.isServerForObject)
            {
                Level.Add(newHat);
                Duck d = teamHat.equippedDuck;
                if (d != null)
                {
                    d.Equip(newHat, false);
                    d.Fondle(newHat);

                    TeamSelect2 lobby = Level.current as TeamSelect2;
                    if (lobby != null)
                    {
                        ProfileBox2 box = lobby.GetBox(d.PlayerIndex());
                        box._hatSelector.hat = newHat;
                    }
                }
            }
            Level.Remove(teamHat);
            teamSpawnsDone.Add(teamHat, null);
        }
예제 #3
0
 public override void Update()
 {
     this._sprite.frame = this.owner == null ? 1 : 0;
     if (this.isServerForObject)
     {
         if ((double)this._beamTime > 1.0 || this.owner == null)
         {
             this._beamTime    = 0.0f;
             this._triggerHeld = false;
             this.LoseControl();
         }
         if (this._controlledDuck != null && this.owner is Duck owner)
         {
             if (Network.isActive)
             {
                 this._controlledDuck.mindControl = owner.inputProfile;
                 owner.Fondle((Thing)this._controlledDuck);
                 owner.Fondle((Thing)this._controlledDuck.holdObject);
                 foreach (Equipment equipment in this._controlledDuck._equipment)
                 {
                     owner.Fondle((Thing)equipment);
                 }
                 owner.Fondle((Thing)this._controlledDuck._ragdollInstance);
                 owner.Fondle((Thing)this._controlledDuck._trappedInstance);
                 owner.Fondle((Thing)this._controlledDuck._cookedInstance);
             }
             if (owner.inputProfile.Pressed("QUACK") || this._controlledDuck.dead || this._controlledDuck.HasEquipment(typeof(TinfoilHat)))
             {
                 this._beamTime    = 0.0f;
                 this._triggerHeld = false;
                 this.LoseControl();
                 return;
             }
             this._triggerHeld = true;
             if ((double)this._controlledDuck.x < (double)owner.x)
             {
                 owner.offDir = (sbyte)-1;
             }
             else
             {
                 owner.offDir = (sbyte)1;
             }
         }
     }
     else
     {
         Duck owner = this.owner as Duck;
         if (this._controlledDuck != null && owner != null)
         {
             this._controlledDuck.mindControl = owner.inputProfile;
             owner.Fondle((Thing)this._controlledDuck.holdObject);
             foreach (Equipment equipment in this._controlledDuck._equipment)
             {
                 owner.Fondle((Thing)equipment);
             }
             owner.Fondle((Thing)this._controlledDuck._ragdollInstance);
             owner.Fondle((Thing)this._controlledDuck._trappedInstance);
             owner.Fondle((Thing)this._controlledDuck._cookedInstance);
         }
         if (this._controlledDuck == null && this._prevControlDuck != null)
         {
             this._prevControlDuck.mindControl = (InputProfile)null;
         }
         this._prevControlDuck = this._controlledDuck;
     }
     if (this._triggerHeld && this._controlledDuck != null)
     {
         this._beamTime       += 0.005f;
         this._beamSound.pitch = Maths.NormalizeSection(this._beamTime, 0.5f, 1f) * 0.6f;
     }
     else
     {
         this._beamSound.pitch = 0.0f;
     }
     if (this._triggerHeld && this._beamTimer.hit)
     {
         Vec2 vec2 = this.Offset(this.barrelOffset);
         if (this.isServerForObject)
         {
             Level.Add((Thing) new ControlWave(vec2.x, vec2.y, this.barrelAngle, this));
         }
         if (this._controlledDuck != null)
         {
             ++this._boltWait;
             if (this._boltWait > 2)
             {
                 Level.Add((Thing) new MindControlBolt(vec2.x, vec2.y, this._controlledDuck));
                 this._boltWait = 0;
             }
         }
         else
         {
             this._boltWait = 0;
         }
     }
     this._beamSound.lerpVolume = this._triggerHeld ? 0.5f : 0.0f;
     if ((double)this._canConvert > 0.0)
     {
         this._canConvert -= 0.02f;
     }
     else
     {
         this._canConvert = 0.0f;
     }
     base.Update();
 }
예제 #4
0
 public override void Update()
 {
     base.Update();
     this._sprite.frame = this._owner == null || this._raised ? 0 : 1;
     this._raiseArm     = Lerp.Float(this._raiseArm, 0.0f, 0.05f);
     this._preachWait   = Lerp.Float(this._preachWait, 0.0f, 0.06f);
     this._ringPulse    = Lerp.Float(this._ringPulse, 0.0f, 0.05f);
     if (Network.isActive)
     {
         if (this.isServerForObject)
         {
             if (this.controlling1)
             {
                 Duck duck = this.GetDuck(0);
                 if (duck != null)
                 {
                     if (duck.listenTime <= 0)
                     {
                         this.controlling1 = false;
                     }
                     else
                     {
                         this.Fondle((Thing)duck);
                         this.Fondle((Thing)duck.holdObject);
                         foreach (Thing t in duck._equipment)
                         {
                             this.Fondle(t);
                         }
                         this.Fondle((Thing)duck._ragdollInstance);
                         this.Fondle((Thing)duck._trappedInstance);
                         this.Fondle((Thing)duck._cookedInstance);
                     }
                 }
             }
             if (this.controlling2)
             {
                 Duck duck = this.GetDuck(1);
                 if (duck != null)
                 {
                     if (duck.listenTime <= 0)
                     {
                         this.controlling2 = false;
                     }
                     else
                     {
                         this.Fondle((Thing)duck);
                         this.Fondle((Thing)duck.holdObject);
                         foreach (Thing t in duck._equipment)
                         {
                             this.Fondle(t);
                         }
                         this.Fondle((Thing)duck._ragdollInstance);
                         this.Fondle((Thing)duck._trappedInstance);
                         this.Fondle((Thing)duck._cookedInstance);
                     }
                 }
             }
             if (this.controlling3)
             {
                 Duck duck = this.GetDuck(2);
                 if (duck != null)
                 {
                     if (duck.listenTime <= 0)
                     {
                         this.controlling3 = false;
                     }
                     else
                     {
                         this.Fondle((Thing)duck);
                         this.Fondle((Thing)duck.holdObject);
                         foreach (Thing t in duck._equipment)
                         {
                             this.Fondle(t);
                         }
                         this.Fondle((Thing)duck._ragdollInstance);
                         this.Fondle((Thing)duck._trappedInstance);
                         this.Fondle((Thing)duck._cookedInstance);
                     }
                 }
             }
             if (this.controlling4)
             {
                 Duck duck = this.GetDuck(3);
                 if (duck != null)
                 {
                     if (duck.listenTime <= 0)
                     {
                         this.controlling4 = false;
                     }
                     else
                     {
                         this.Fondle((Thing)duck);
                         this.Fondle((Thing)duck.holdObject);
                         foreach (Thing t in duck._equipment)
                         {
                             this.Fondle(t);
                         }
                         this.Fondle((Thing)duck._ragdollInstance);
                         this.Fondle((Thing)duck._trappedInstance);
                         this.Fondle((Thing)duck._cookedInstance);
                     }
                 }
             }
         }
         else
         {
             Duck duck1 = this.GetDuck(0);
             if (duck1 != null)
             {
                 if (this.controlling1)
                 {
                     duck1.listening = true;
                     duck1.Fondle((Thing)duck1.holdObject);
                     foreach (Equipment equipment in duck1._equipment)
                     {
                         duck1.Fondle((Thing)equipment);
                     }
                     duck1.Fondle((Thing)duck1._ragdollInstance);
                     duck1.Fondle((Thing)duck1._trappedInstance);
                     duck1.Fondle((Thing)duck1._cookedInstance);
                 }
                 if (!this.controlling1 && this.prevControlling1)
                 {
                     duck1.listening = false;
                 }
                 this.prevControlling1 = this.controlling1;
             }
             Duck duck2 = this.GetDuck(1);
             if (duck2 != null)
             {
                 if (this.controlling2)
                 {
                     duck2.listening = true;
                     duck2.Fondle((Thing)duck2.holdObject);
                     foreach (Equipment equipment in duck2._equipment)
                     {
                         duck2.Fondle((Thing)equipment);
                     }
                     duck2.Fondle((Thing)duck2._ragdollInstance);
                     duck2.Fondle((Thing)duck2._trappedInstance);
                     duck2.Fondle((Thing)duck2._cookedInstance);
                 }
                 if (!this.controlling2 && this.prevControlling2)
                 {
                     duck2.listening = false;
                 }
                 this.prevControlling2 = this.controlling2;
             }
             Duck duck3 = this.GetDuck(2);
             if (duck3 != null)
             {
                 if (this.controlling3)
                 {
                     duck3.listening = true;
                     duck3.Fondle((Thing)duck3.holdObject);
                     foreach (Equipment equipment in duck3._equipment)
                     {
                         duck3.Fondle((Thing)equipment);
                     }
                     duck3.Fondle((Thing)duck3._ragdollInstance);
                     duck3.Fondle((Thing)duck3._trappedInstance);
                     duck3.Fondle((Thing)duck3._cookedInstance);
                 }
                 if (!this.controlling3 && this.prevControlling3)
                 {
                     duck3.listening = false;
                 }
                 this.prevControlling3 = this.controlling3;
             }
             Duck duck4 = this.GetDuck(3);
             if (duck4 != null)
             {
                 if (this.controlling4)
                 {
                     duck4.listening = true;
                     duck4.Fondle((Thing)duck4.holdObject);
                     foreach (Equipment equipment in duck4._equipment)
                     {
                         duck4.Fondle((Thing)equipment);
                     }
                     duck4.Fondle((Thing)duck4._ragdollInstance);
                     duck4.Fondle((Thing)duck4._trappedInstance);
                     duck4.Fondle((Thing)duck4._cookedInstance);
                 }
                 if (!this.controlling4 && this.prevControlling4)
                 {
                     duck4.listening = false;
                 }
                 this.prevControlling4 = this.controlling4;
             }
         }
     }
     if (this._triggerHeld && this.isServerForObject && (this.duck != null && (double)this._preachWait <= 0.0 & this.duck.quack < 1) && this.duck.grounded)
     {
         if (Network.isActive)
         {
             this._netPreach.Play();
         }
         else
         {
             SFX.Play("preach" + (object)Rando.Int(5), Rando.Float(0.8f, 1f), Rando.Float(-0.2f, -0.3f));
         }
         this.duck.quack = (int)(byte)Rando.Int(12, 30);
         this.duck.profile.stats.timePreaching += (float)this.duck.quack / 0.1f * Maths.IncFrameTimer();
         this._preachWait = Rando.Float(1.8f, 2.5f);
         this._ringPulse  = 1f;
         if (Rando.Int(1) == 0)
         {
             this._raiseArm = Rando.Float(1.2f, 2f);
         }
         Ragdoll ragdoll = Level.Nearest <Ragdoll>(this.x, this.y, (Thing)this);
         if (ragdoll != null && ragdoll.captureDuck != null && (ragdoll.captureDuck.dead && Level.CheckLine <Block>(this.duck.position, ragdoll.position) == null) && (double)(ragdoll.position - this.duck.position).length < (double)this._ammoType.range)
         {
             if (Network.isActive)
             {
                 this.Fondle((Thing)ragdoll.captureDuck);
                 this.Fondle((Thing)ragdoll);
                 Send.Message((NetMessage) new NMLayToRest(ragdoll.captureDuck.profile.networkIndex));
             }
             ragdoll.captureDuck.LayToRest(this.duck.profile);
         }
         foreach (Duck duck in Level.current.things[typeof(Duck)])
         {
             if (duck != this.duck && duck.grounded && (!(duck.holdObject is GoodBook) && Level.CheckLine <Block>(this.duck.position, duck.position) == null) && (double)(duck.position - this.duck.position).length < (double)this._ammoType.range)
             {
                 if (duck.dead)
                 {
                     this.Fondle((Thing)duck);
                     duck.LayToRest(this.duck.profile);
                 }
                 else if (duck.converted != this.duck && this.duck.converted != duck && duck.profile.team != this.duck.profile.team)
                 {
                     if (Network.isActive)
                     {
                         if (duck.profile.networkIndex == (byte)0)
                         {
                             this.controlling1 = true;
                         }
                         if (duck.profile.networkIndex == (byte)1)
                         {
                             this.controlling2 = true;
                         }
                         if (duck.profile.networkIndex == (byte)2)
                         {
                             this.controlling3 = true;
                         }
                         if (duck.profile.networkIndex == (byte)3)
                         {
                             this.controlling4 = true;
                         }
                     }
                     duck.listening = true;
                     this.Fondle((Thing)duck);
                     this.Fondle((Thing)duck.holdObject);
                     foreach (Thing t in duck._equipment)
                     {
                         this.Fondle(t);
                     }
                     this.Fondle((Thing)duck._ragdollInstance);
                     this.Fondle((Thing)duck._trappedInstance);
                     this.Fondle((Thing)duck._cookedInstance);
                     duck.listenTime = 80;
                     if ((double)this.owner.x < (double)duck.x)
                     {
                         duck.offDir = (sbyte)-1;
                     }
                     else
                     {
                         duck.offDir = (sbyte)1;
                     }
                     duck.ThrowItem(false);
                     duck.conversionResistance -= 30;
                     if (duck.conversionResistance <= 0)
                     {
                         duck.ConvertDuck(this.duck.converted != null ? this.duck.converted : this.duck);
                         if (Network.isActive)
                         {
                             Send.Message((NetMessage) new NMConversion(duck.profile.networkIndex, this.duck.profile.networkIndex));
                         }
                         duck.conversionResistance = 50;
                     }
                 }
             }
         }
     }
     this._haloAlpha = Lerp.Float(this._haloAlpha, !this._triggerHeld || this.duck == null || !this.duck.grounded ? 0.0f : 1f, 0.05f);
 }