/// <summary>
        /// Gets the colour the item should be displayed as. It should be darker if the gun is reloading
        /// </summary>
        /// <param name="x"></param>
        /// <returns></returns>
        private Color GetReloadColour(Gun gun, Color original)
        {
            Color temp = original;

            temp *= 1 - ((float)gun.ReloadCooldown / (gun.ReloadTime * 1.3f));
            //Restore the alpha
            temp.A = original.A;
            temp.B = 255;
            return temp;
        }
Esempio n. 2
0
        public static Item Create(int type, int amount = -1, Entity owner = null)
        {
            Item newItem;
            if (GameData.GameItems[type] is Gun)
                newItem = new Gun(type, amount, owner);
            else if (GameData.GameItems[type] is Melee)
                newItem = new Melee(type, amount, owner);
            else if (GameData.GameItems[type] is Goggles)
                newItem = new Goggles(type, owner);
            else if (GameData.GameItems[type] is Torch)
                newItem = new Torch(type, owner);
            else if (GameData.GameItems[type] is SmartPhone)
                newItem = new SmartPhone(type, owner);
            else if (GameData.GameItems[type] is Togglable)
                newItem = new Togglable(type, owner);
            else
                newItem = new Item(type, amount, owner);

            return newItem;
        }