示例#1
0
        /// <summary>
        /// Creates a new bottle return machine
        /// </summary>
        /// <param name="pos">Position on the screen</param>
        /// <param name="texture">What texture it will use</param>
        /// <param name="myMachType">What kind of machine it is</param>
        public machine(Vector2 pos, Texture2D texture, machineType myMachType, GraphicsDevice gDevice,
                        SoundEffect machineSound, SoundEffect ticketSound, Texture2D[] rejectTextures)
        {
            this.rejectTextures = rejectTextures;
            machineTexture = texture;
            machineRect = new Rectangle((int)pos.X, (int)pos.Y, texture.Width, texture.Height);
            machineType = myMachType;
            this.machineSound = machineSound;
            this.ticketSound = ticketSound;
            currentSound = machineSound.CreateInstance();

            hitbox = new Rectangle(0, 0, 90, 90);
            ticketHitbox = new Rectangle(0, 0, 20, 20);
            rejectHitbox = new Rectangle(0, 0, 90, 90);
            switch (machineType)
            {
                // I had no idea all the bottle machine textures were so similar
                case machineType.CANS:
                    hitbox.X = machineRect.X + 442 - (hitbox.Width / 2);
                    hitbox.Y = machineRect.Y + 244 - (hitbox.Height / 2);
                    ticketHitbox.X = machineRect.X + 258 - (ticketHitbox.Width / 2);
                    ticketHitbox.Y = machineRect.Y + 280 - (ticketHitbox.Height / 2);
                    rejectHitbox.X = machineRect.X + 258 - (ticketHitbox.Width / 2);
                    rejectHitbox.Y = machineRect.Y + 280 - (ticketHitbox.Height / 2);
                    break;
                case machineType.GLASS:
                    hitbox.X = machineRect.X + 442 - (hitbox.Width / 2);
                    hitbox.Y = machineRect.Y + 244 - (hitbox.Height / 2);
                    ticketHitbox.X = machineRect.X + 258 - (ticketHitbox.Width / 2);
                    ticketHitbox.Y = machineRect.Y + 280 - (ticketHitbox.Height / 2);
                    rejectHitbox.X = machineRect.X + 258 - (ticketHitbox.Width / 2);
                    rejectHitbox.Y = machineRect.Y + 280 - (ticketHitbox.Height / 2);
                    break;
                case machineType.PLASTIC:
                    hitbox.X = machineRect.X + 442 - (hitbox.Width / 2);
                    hitbox.Y = machineRect.Y + 244 - (hitbox.Height / 2);
                    ticketHitbox.X = machineRect.X + 258 - (ticketHitbox.Width / 2);
                    ticketHitbox.Y = machineRect.Y + 280 - (ticketHitbox.Height / 2);
                    rejectHitbox.X = machineRect.X + 258 - (ticketHitbox.Width / 2);
                    rejectHitbox.Y = machineRect.Y + 280 - (ticketHitbox.Height / 2);
                    break;
            }

            // Create an orange debug texture for the hitboxes:
            hitboxDebug = new Texture2D(gDevice, hitbox.Width, hitbox.Height);
            UInt32[] SETME = new UInt32[hitboxDebug.Width * hitboxDebug.Height];
            for (int i = 0; i < SETME.Length; i++)
            {
                SETME[i] = 0xFFFF8040;
            }
            hitboxDebug.SetData<UInt32>(SETME);
        }
示例#2
0
        /// <summary>
        /// Copy constructor
        /// </summary>
        /// <param name="toCopy"></param>
        public machine(machine toCopy)
        {
            machineRect = toCopy.machineRect;
            hitbox = toCopy.hitbox;
            hitboxDebug = toCopy.hitboxDebug;
            machineTexture = toCopy.machineTexture;
            machineType = toCopy.machineType;

            machineSound = toCopy.machineSound;
            currentSound = toCopy.currentSound;
        }
示例#3
0
 public void MarkAsModified(machineType item)
 {
 }