AI захватит мир
This commit is contained in:
32
Code/Inventory/Definitions/AmmoItemDefinition.cs
Normal file
32
Code/Inventory/Definitions/AmmoItemDefinition.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
namespace Sasalka;
|
||||
|
||||
[GameResource( "Ammo Item Definition", "ammo", "", Category = "Sasalka", Icon = "inventory_2" )]
|
||||
public class AmmoItemDefinition : BaseItemDefinition
|
||||
{
|
||||
[Property, Category( "Ammo Properties" )]
|
||||
public string AmmoType { get; set; } = "Pistol";
|
||||
|
||||
[Property, Category( "Ammo Properties" )]
|
||||
public float Damage { get; set; } = 10f;
|
||||
|
||||
[Property, Category( "Ammo Properties" )]
|
||||
public float Penetration { get; set; } = 0f;
|
||||
|
||||
[Property, Category( "Ammo Properties" )]
|
||||
public bool IsExplosive { get; set; } = false;
|
||||
|
||||
[Property, Category( "Ammo Properties" )]
|
||||
public float ExplosionRadius { get; set; } = 0f;
|
||||
|
||||
[Property, Category( "Ammo Properties" )]
|
||||
public string CompatibleWeapons { get; set; } = "";
|
||||
|
||||
public override ItemCategory Category => ItemCategory.Ammo;
|
||||
|
||||
public override bool CanUse() => false; // Патроны нельзя использовать напрямую
|
||||
|
||||
public bool IsCompatibleWith( string ammoType )
|
||||
{
|
||||
return AmmoType == ammoType;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,92 @@
|
||||
namespace Sasalka;
|
||||
|
||||
[GameResource( "Base Item Definition", "inv", "", Category = "Sasalka", Icon = "inventory_2" )]
|
||||
public enum ItemCategory
|
||||
{
|
||||
Weapon,
|
||||
Clothing,
|
||||
Ammo,
|
||||
Consumable,
|
||||
Tool,
|
||||
Misc
|
||||
}
|
||||
|
||||
public enum ItemRarity
|
||||
{
|
||||
Common,
|
||||
Uncommon,
|
||||
Rare,
|
||||
Epic,
|
||||
Legendary
|
||||
}
|
||||
|
||||
[GameResource("Base Item Definition", "inv", "", Category = "Sasalka", Icon = "inventory_2")]
|
||||
public class BaseItemDefinition : GameResource
|
||||
{
|
||||
public string Name { get; set; }
|
||||
[Property, Title("Basic Info")]
|
||||
public string Name { get; set; } = "Unknown Item";
|
||||
|
||||
public string Description { get; set; }
|
||||
[Property]
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
[ResourceType( "prefab" )]
|
||||
public GameObject Prefab { get; set; } = GameObject.GetPrefab( "prefabs/item_parcel.prefab" );
|
||||
[Property, Category("Visual")]
|
||||
[ResourceType("prefab")]
|
||||
public GameObject Prefab { get; set; } = GameObject.GetPrefab("prefabs/item_parcel.prefab");
|
||||
|
||||
[Property, Category("Visual")]
|
||||
public Texture ImageTexture { get; set; }
|
||||
|
||||
[Property, Category("Visual")]
|
||||
public string ImageUrl { get; set; }
|
||||
|
||||
[Property, Category("Properties")]
|
||||
[Range(1, 1000)]
|
||||
public int MaxCount { get; set; } = 1;
|
||||
|
||||
[Property, Category("Properties")]
|
||||
public virtual ItemCategory Category { get; set; } = ItemCategory.Misc;
|
||||
|
||||
[Property, Category("Properties")]
|
||||
public ItemRarity Rarity { get; set; } = ItemRarity.Common;
|
||||
|
||||
[Property, Category("Properties")]
|
||||
public float Weight { get; set; } = 1.0f;
|
||||
|
||||
[Property, Category("Properties")]
|
||||
public bool IsStackable => MaxCount > 1;
|
||||
|
||||
[Property, Category("Properties")]
|
||||
public bool IsEquipable => this is IEquipable;
|
||||
|
||||
public virtual Inventar.InventorySlot? GetSlot() => null;
|
||||
|
||||
public virtual bool CanUse() => false;
|
||||
|
||||
public virtual void OnUse(InventoryItem item) { }
|
||||
|
||||
public string GetRarityColor()
|
||||
{
|
||||
return Rarity switch
|
||||
{
|
||||
ItemRarity.Common => "#ffffff",
|
||||
ItemRarity.Uncommon => "#1eff00",
|
||||
ItemRarity.Rare => "#0070dd",
|
||||
ItemRarity.Epic => "#a335ee",
|
||||
ItemRarity.Legendary => "#ff8000",
|
||||
_ => "#ffffff"
|
||||
};
|
||||
}
|
||||
|
||||
public string GetCategoryIcon()
|
||||
{
|
||||
return Category switch
|
||||
{
|
||||
ItemCategory.Weapon => "🔫",
|
||||
ItemCategory.Clothing => "👕",
|
||||
ItemCategory.Ammo => "💥",
|
||||
ItemCategory.Consumable => "🍖",
|
||||
ItemCategory.Tool => "🔧",
|
||||
ItemCategory.Misc => "📦",
|
||||
_ => "📦"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,29 @@
|
||||
[GameResource( "Clothing Item Definition", "clitem", "", Category = "Sasalka", Icon = "inventory_2" )]
|
||||
public class ClothingItemDefinition : BaseItemDefinition, IEquipable
|
||||
{
|
||||
[Property] public string ClothUrl { get; set; }
|
||||
[Property, Category( "Clothing Properties" )]
|
||||
public string ClothUrl { get; set; }
|
||||
|
||||
[Property, Category( "Clothing Properties" )]
|
||||
public Inventar.InventorySlot Slot { get; set; }
|
||||
|
||||
[Property, Category( "Clothing Properties" )]
|
||||
public float ArmorValue { get; set; } = 0f;
|
||||
|
||||
[Property, Category( "Clothing Properties" )]
|
||||
public bool IsVisible { get; set; } = true;
|
||||
|
||||
[Property, Category( "Clothing Properties" )]
|
||||
public string BodyPart { get; set; } = "";
|
||||
|
||||
public override Inventar.InventorySlot? GetSlot() => Slot;
|
||||
|
||||
public override ItemCategory Category => ItemCategory.Clothing;
|
||||
|
||||
public override bool CanUse() => true;
|
||||
|
||||
public override void OnUse( InventoryItem item )
|
||||
{
|
||||
// Логика экипировки одежды
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,16 +5,55 @@ namespace Sasalka;
|
||||
[GameResource( "Weapon Item Definition", "weapon", "", Category = "Sasalka", Icon = "inventory_2" )]
|
||||
public class WeaponItemDefinition : BaseItemDefinition, IEquipable
|
||||
{
|
||||
[Property, Category( "Weapon Properties" )]
|
||||
public Inventar.InventorySlot Slot { get; set; }
|
||||
|
||||
public override Inventar.InventorySlot? GetSlot() => Slot;
|
||||
[Property, Category( "Weapon Properties" )]
|
||||
public CitizenAnimationHelper.HoldTypes HoldType { get; set; } = CitizenAnimationHelper.HoldTypes.None;
|
||||
[InlineEditor, Space] public WeaponDefinition WeaponDefinition { get; set; }
|
||||
|
||||
[Property, Category( "Weapon Properties" )]
|
||||
[InlineEditor, Space]
|
||||
public WeaponDefinition WeaponDefinition { get; set; }
|
||||
|
||||
[Property, Category( "Weapon Properties" )]
|
||||
public float Damage { get; set; } = 10f;
|
||||
|
||||
[Property, Category( "Weapon Properties" )]
|
||||
public float FireRate { get; set; } = 1f;
|
||||
|
||||
[Property, Category( "Weapon Properties" )]
|
||||
public float Range { get; set; } = 1000f;
|
||||
|
||||
[Property, Category( "Weapon Properties" )]
|
||||
public int MagazineSize { get; set; } = 30;
|
||||
|
||||
[Property, Category( "Weapon Properties" )]
|
||||
public string AmmoType { get; set; } = "Pistol";
|
||||
|
||||
public override Inventar.InventorySlot? GetSlot() => Slot;
|
||||
|
||||
public override ItemCategory Category => ItemCategory.Weapon;
|
||||
|
||||
public override bool CanUse() => true;
|
||||
|
||||
public override void OnUse( InventoryItem item )
|
||||
{
|
||||
// Логика использования оружия будет в компоненте Weapon
|
||||
}
|
||||
}
|
||||
|
||||
public struct WeaponDefinition
|
||||
{
|
||||
// public CitizenAnimationHelper.Hand Hand { get; set; }
|
||||
public Vector3 Position { get; set; }
|
||||
public Rotation Rotation { get; set; }
|
||||
[Property] public Vector3 Position { get; set; }
|
||||
|
||||
[Property] public Rotation Rotation { get; set; }
|
||||
|
||||
[Property] public Vector3 Scale { get; set; }
|
||||
|
||||
public WeaponDefinition()
|
||||
{
|
||||
Position = Vector3.Zero;
|
||||
Rotation = Rotation.Identity;
|
||||
Scale = Vector3.One;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user