Skip to content

Instantly share code, notes, and snippets.

@samneirinck
Created April 29, 2012 00:14
Show Gist options
  • Save samneirinck/2522840 to your computer and use it in GitHub Desktop.
Save samneirinck/2522840 to your computer and use it in GitHub Desktop.
namespace CryEngine
{
/// <summary>
/// ItemSystem contains scriptbinds used in relation to the item system.
/// </summary>
public class ItemSystem
{
private static IItemSystemMethods _itemSystemMethods;
internal static IItemSystemMethods Methods {
get
{
return _itemSystemMethods ?? (_itemSystemMethods = new NativeItemSystemMethods());
}
set
{
_itemSystemMethods = value;
}
}
private class NativeItemSystemMethods : IItemSystemMethods
{
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern void CacheItemGeometry(string itemClass);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern void CacheItemSound(string itemClass);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern void _GiveItem(uint entityId, string itemClass);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern void _GiveEquipmentPack(uint entityId, string equipmentPack);
}
public static void GiveItem(EntityId actorId, string itemClass)
{
Methods._GiveItem(actorId, itemClass);
}
public static void GiveEquipmentPack(EntityId actorId, string equipmentPack)
{
Methods._GiveEquipmentPack(actorId, equipmentPack);
}
}
public interface IItemSystemMethods
{
void CacheItemGeometry(string itemClass);
void CacheItemSound(string itemClass);
void _GiveItem(uint entityId, string itemClass);
void _GiveEquipmentPack(uint entityId, string equipmentPack);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment