Пример #1
0
 public override void Initialize()
 {
     this._cape = new Cape(this.x, this.y, (PhysicsObject)this, true);
     this._cape._capeTexture = new Sprite("rainbowCarp").texture;
     Level.Add((Thing)this._cape);
     base.Initialize();
 }
Пример #2
0
 public override void Update()
 {
     if (this._switchFrames > 0)
     {
         --this._switchFrames;
     }
     if (this._ruined)
     {
         if (this._cape != null)
         {
             Level.Remove((Thing)this._cape);
             this._cape = (Cape)null;
         }
         this.graphic = this._damaged;
         if ((double)this._ghostWait > 0.0)
         {
             this._ghostWait -= 0.4f;
         }
         else
         {
             if (!this._madeGhost)
             {
                 Level.Add((Thing) new EscapingGhost(this.x, this.y - 6f));
                 for (int index = 0; index < 8; ++index)
                 {
                     Level.Add((Thing)Spark.New(this.x + Rando.Float(-8f, 8f), this.y + Rando.Float(-8f, 8f), new Vec2(Rando.Float(-1f, 1f), Rando.Float(-1f, 1f))));
                 }
             }
             this._madeGhost = true;
         }
     }
     base.Update();
 }
        public override void Draw(float x, float y, Depth depth)
        {
            if (this._team == null)
            {
                return;
            }
            y -= 9f;
            float x1 = x;
            float y1 = y + 8f;

            this._persona.sprite.depth = depth;
            this._persona.sprite.color = Color.White;
            DuckGame.Graphics.Draw(this._persona.sprite, 0, x1, y1);
            this._persona.armSprite.frame = this._persona.sprite.imageIndex;
            this._persona.armSprite.scale = new Vec2(1f, 1f);
            this._persona.armSprite.depth = depth + 4;
            DuckGame.Graphics.Draw((Sprite)this._persona.armSprite, x1 - 3f, y1 + 6f);
            Vec2 hatPoint = DuckRig.GetHatPoint(this._persona.sprite.imageIndex);

            this._team.hat.depth  = depth + 2;
            this._team.hat.center = new Vec2(16f, 16f) + this._team.hatOffset;
            DuckGame.Graphics.Draw(this._team.hat, this._team.hat.frame, x1 + hatPoint.x, y1 + hatPoint.y);
            if (this._team.hat.texture.textureName == "hats/devhat" && this._cape == null)
            {
                this._hat  = new TeamHat(x1 + hatPoint.x, (float)((double)y1 + (double)hatPoint.y + 5.0), Teams.GetTeam("CAPTAIN"));
                this._cape = new Cape(x1 + hatPoint.x, y1 + hatPoint.y, (PhysicsObject)this._hat);
            }
            if (this._team.hat.texture.textureName == "hats/moonwalker" && this._cape == null)
            {
                this._hat  = new TeamHat(x1 + hatPoint.x, (float)((double)y1 + (double)hatPoint.y + 5.0), Teams.GetTeam("MOONWALK"));
                this._cape = new Cape(x1 + hatPoint.x, y1 + hatPoint.y, (PhysicsObject)this._hat);
                this._cape.SetCapeTexture((Texture2D)Content.Load <Tex2D>("hats/moonCape"));
            }
            if (this._team.hat.texture.textureName == "hats/royalty" && this._cape == null)
            {
                this._hat  = new TeamHat(x1 + hatPoint.x, (float)((double)y1 + (double)hatPoint.y + 5.0), Teams.GetTeam("MAJESTY"));
                this._cape = new Cape(x1 + hatPoint.x, y1 + hatPoint.y, (PhysicsObject)this._hat);
                this._cape.SetCapeTexture((Texture2D)Content.Load <Tex2D>("hats/royalCape"));
            }
            if (this._cape == null)
            {
                return;
            }
            this._hat.position = new Vec2(x1 + hatPoint.x, (float)((double)y1 + (double)hatPoint.y + 5.0));
            this._cape.depth   = depth + 2;
            this._cape.Update();
            this._cape.Draw();
        }
Пример #4
0
        void AddCape(Duck duck)
        {
            if (CapeTexture == null)
            {
                return;                         //The skin had no cape texture, return.
            }
            Cape cape = new Cape(0, 0, duck);

            cape.SetCapeTexture(CapeTexture);
            Level.Add(cape);                //Add Cape to the level.

            if (Capes.ContainsKey(duck))    //If theres already a cape in the level
            {
                Level.Remove(Capes[duck]);  //Remove the already existing cape from the level
                Capes[duck] = cape;         //Change the cape.

                return;
            }

            Capes.Add(duck, cape);          //If no existing cape was found, add it to the dictionary.
        }