Exemplo n.º 1
0
        public MushroomSprite(Mushroom redMushroom, MushroomType type)
        {
            this.Mushroom = redMushroom;
            this.Texture  = SpriteHolder.PowerUps;
            switch (type)
            {
            case MushroomType.Green:
                this.Row    = (int)SpriteHolder.GreenMushroomCoordinates[0];
                this.Column = (int)SpriteHolder.GreenMushroomCoordinates[1];
                break;

            case MushroomType.Red:
                this.Row    = (int)SpriteHolder.RedMushroomCoordinates[0];
                this.Column = (int)SpriteHolder.RedMushroomCoordinates[1];
                break;

            case MushroomType.Metal:
                this.Row    = (int)SpriteHolder.MetalMushroomCoordinates[0];
                this.Column = (int)SpriteHolder.MetalMushroomCoordinates[1];
                break;
            }

            this.Width  = SpriteHolder.PowerUpWidth;
            this.Height = SpriteHolder.PowerUpHeight;

            this.SpawningCounter = 0;
            this.SpawnDelay      = 0;
        }
Exemplo n.º 2
0
        public Mushroom(Board board, int x, int y, int w, int h, Random rand, Texture2D greenMush, Texture2D blueMush, Texture2D redMush)
        {
            this.board = board;
            W          = w;
            H          = h;
            X          = x * W;
            Y          = y * H;
            Array values = Enum.GetValues(typeof(MushroomType));

            mushType = (MushroomType)values.GetValue(rand.Next(0, values.Length));
            switch (mushType)
            {
            case MushroomType.Green:
                sprite = greenMush;
                break;

            case MushroomType.Blue:
                sprite = blueMush;
                break;

            case MushroomType.Red:
                sprite = redMush;
                break;
            }
        }
Exemplo n.º 3
0
 public Mushroom(Vector2 startPosition, bool Spawning, MushroomType type)
 {
     this.Type               = type;
     this.CurrentVelocity    = new Vector2(ItemConfig.MushroomVelocity, 0);
     this.CurrentPosition    = startPosition;
     this.Sprite             = new MushroomSprite(this, type);
     this.CollisionResponder = new MushroomCollisionResponder(this);
     this.Spawning           = Spawning;
 }
Exemplo n.º 4
0
 public Mushroom(MushroomType mtype, GameDirection direction, float top, float left)
     : base(Mushroom.GetMushroomImage(mtype),
     top - Mushroom.GetMushroomImage(mtype).Height,
     left)
 {
     this.mtype = mtype;
     distance = 0;
     this.direction = direction;
 }
Exemplo n.º 5
0
        public Mushroom(MushroomType mushroomType)
        {
            MushroomType = mushroomType;

            CanBeEaten = true;

            if (mushroomType == MushroomType.Bad)
            {
                DamagePoint = new Random().Next(5, 15);
            }

            Count++;
        }
Exemplo n.º 6
0
        public static Rectangle Mushroom(MushroomType type)
        {
            Rectangle rectangle = new Rectangle();

            if (type == MushroomType.Super)
            {
                rectangle = new Rectangle(0, 0, ITEM_WIDTH, ITEM_HEIGHT);
            }
            else if (type == MushroomType._1Up)
            {
                rectangle = new Rectangle(ITEM_WIDTH, 0, ITEM_WIDTH, ITEM_HEIGHT);
            }
            return(rectangle);
        }
Exemplo n.º 7
0
        }                                                                       //22

        //Constructor
        public Mushroom(MushroomType type, char capShape, char capSurface, char capColor, char bruises, char odor, char gillAttachment, char gillSpacing,
                        char gillSize, char gillColor, char stalkShape, char stalkRoot, char stalkSurfaceAboveRing, char stalkSurfaceBelowRing, char stalkColorAboveRing,
                        char stalkColorBelowRing, char veilType, char veilColor, char ringNumber, char ringType, char sporePrintColor, char population, char habitad)
        {
            if (VerifyMushroom(capShape, capSurface, capColor, bruises, odor, gillAttachment, gillSpacing, gillSize, gillColor, stalkShape, stalkRoot,
                               stalkSurfaceAboveRing, stalkSurfaceBelowRing, stalkColorAboveRing, stalkColorBelowRing, veilType, veilColor, ringNumber, ringType,
                               sporePrintColor, population, habitad))
            {
                this.type = type;                                   //0

                this.capShape   = capShape;                         //1
                this.capSurface = capSurface;                       //2
                this.capColor   = capColor;                         //3

                this.bruises = bruises;                             //4
                this.odor    = odor;                                //5

                this.gillAttachment = gillAttachment;               //6
                this.gillSpacing    = gillSpacing;                  //7
                this.gillSize       = gillSize;                     //8
                this.gillColor      = gillColor;                    //9

                this.stalkShape            = stalkShape;            //10
                this.stalkRoot             = stalkRoot;             //11
                this.stalkSurfaceAboveRing = stalkSurfaceAboveRing; //12
                this.stalkSurfaceBelowRing = stalkSurfaceBelowRing; //13
                this.stalkColorAboveRing   = stalkColorAboveRing;   //14
                this.stalkColorBelowRing   = stalkColorBelowRing;   //15

                this.veilType  = veilType;                          //16
                this.veilColor = veilColor;                         //17

                this.ringNumber = ringNumber;                       //18
                this.ringType   = ringType;                         //19

                this.sporePrintColor = sporePrintColor;             //20
                this.population      = population;                  //21
                this.habitat         = habitad;                     //22
            }
            else
            {
                throw new InvalidValuesException();
            }
        }
Exemplo n.º 8
0
        public MushroomSprite(int positionX, int positionY, MushroomType mushroomType)
        {
            Location    = new Vector2(positionX, positionY);
            WidthHeight = new Vector2(ItemSpriteFactory.ITEM_WIDTH, ItemSpriteFactory.ITEM_HEIGHT);
            Boundary    = new Rectangle((int)Location.X, (int)Location.Y, (int)WidthHeight.X, (int)WidthHeight.Y);

            type         = mushroomType;
            currentFrame = ItemSpriteFactory.Mushroom(type);
            if (mushroomType.Equals(MushroomType.Super))
            {
                EntityType = TileMapInterpreter.Entities.SUPER_MUSHROOM;
            }
            else
            {
                EntityType = TileMapInterpreter.Entities.UP_MUSHROOM;
            }

            IsBounded = false;
        }
        public ActionResult Save(MushroomType mushroomtype)
        {
            var randomId = new Random();  // Solved problem with null ID's, will change it later.

            if (mushroomtype.Id == null)
            {
                mushroomtype.Id = Convert.ToByte(randomId.Next(20, 100));
                _context.MushroomTypes.Add(mushroomtype);
                _context.SaveChanges();
            }
            else
            {
                var mush = _context.MushroomTypes.SingleOrDefault(m => m.Id == mushroomtype.Id);
                mush.Name          = mushroomtype.Name;
                mush.PackageWeight = mushroomtype.PackageWeight;

                _context.SaveChanges();
            }

            return(RedirectToAction("MushroomTypes"));
        }
Exemplo n.º 10
0
 static dImage GetMushroomImage(MushroomType mtype)
 {
     switch (mtype)
     {
         case MushroomType.Good: return GetDraw.Image(Files.mushroom_good);
         case MushroomType.Poison: return GetDraw.Image(Files.mushroom_poison);
         case MushroomType.Live: return GetDraw.Image(Files.mushroom_live);
     }
     return null;
 }