예제 #1
0
        // constructor
        public Player(Vector3 velocity, Animation[] animations, string[] names, Vector3 location, Rectangle rectangle, int life, int moneyGoal)
            : base(velocity, animations, names, location, rectangle)
        {
            startLoc = location;

            // not currently used for anything, but will be implemented by next milestone.
            lives = life;
            moneyNeeded = moneyGoal;
            moneyCollected = 0;

            attackLength = 0;

            currentWeapon = null;
            currentDisguise = null;
        }
        // creates a weapon with a given position, durability before breaking, and type of weapon (vase, tray, candlestick)
        // and sets the animation based on the weapon type.
        public static Weapon GenerateWeapon(Vector3 position, int durability, string weaponType)
        {
            Weapon weapon = new Weapon(
                GameVariables.GetWeaponAnimations(weaponType),
                new String[1] { weaponType },
                position,
                new Rectangle(
                    (int)position.X,
                    (int)position.Y,
                    GameVariables.tileWidth, GameVariables.tileHeight),
                durability);

            weapon.CurrentAnimation = weaponType;

            return weapon;
        }