public Character(string name, RaceType race, GenderType gender, uint age, uint maxHp, uint hp, uint xp = 0, bool isTalkable = true, bool isMovable = true) { this.Name = name; this.Id = nextId++; this.IsTalkable = isTalkable; this.IsMovable = isMovable; this.Race = race; this.Age = age; this.MaxHp = maxHp; this.Hp = hp; this.Xp = xp; this.Gender = gender; this.Inventory = new Inventory.Inventory(this); this.Condition = ConditionType.healthy; conditionLocker = new object(); }
public MainWindowPresenter() { _repo = new ZoneRepo(); _inventory = new Inventory.Inventory(10); _inventoryPresenter = new InventoryPresenter(_inventory); _viewmodel = new MainWindowViewModel() { OpenItemsListCommand = new DelegateCommand(OpenItemsListAction) }; _view = new MainWindowView() { DataContext = _viewmodel, Inventory = { Content = _inventoryPresenter.ViewContent } }; }
/// <summary> /// Deserializesd an <see cref="Inventory"/> from its name into a given <paramref name="inventory"/> /// </summary> /// <param name="inventory">Inventory to apply the data to</param> /// <param name="inventoryName">Inventory to deserialize</param> public static void DeSerializeInventory(Inventory.Inventory inventory, string inventoryName) { //* make the path string inventorySavePath = $"{savePath}/Inventorys/{inventoryName}.dat"; //* checks that the file exists if (!File.Exists(inventorySavePath)) { for (int i = 0; i < inventory.items.itemsInInventory.Length; i++) { inventory.items.itemsInInventory[i] = null; } SerializeInventory(inventory, inventoryName); return; } inventory.SetAllItems((ItemsInInventory)LoadFile($"{inventorySavePath}")); }
public Cow(CowGameScreen cowGameScreen, World world, Vector2 position) : base(cowGameScreen, world, new Rectangle((int)position.X, (int)position.Y, 54, 49), new DynamicAnimatedSprites(cowGameScreen.GameTextures["cowRightWalk"], 3, 16), new DynamicAnimatedSprites(cowGameScreen.GameTextures["cowLeftWalk"], 3, 16), new DynamicAnimatedSprites(cowGameScreen.GameTextures["cowUpWalk"], 3, 16), new DynamicAnimatedSprites(cowGameScreen.GameTextures["cowDownWalk"], 3, 16)) { Inventory = new Inventory.Inventory(cowGameScreen); CraftPanel = new CraftPanel(cowGameScreen); ListBars = new List <StatusBar> { new HealthBar(cowGameScreen, this), new FoodBar(cowGameScreen, this), new SprintBar(cowGameScreen, this) }; Delay = 200f; HealthPoint = 100; StarvePoint = 100; CurrentWorld = world; Boost = 1; SpeedX = 1.5f; SpeedY = 1f; CurrentWorld = world; _interactableList = new List <Entity>(); _attackList = new List <Entity>(); _previousFocusInteractables = new HashSet <Entity>(); _previousFocusAttackables = new HashSet <Entity>(); Body = BodyFactory.CreateRectangle(world, 0.54f, 0.15f, 0, new Vector2((float)DestRect.X / 100, (float)DestRect.Y / 100)); Body.BodyType = BodyType.Dynamic; Body.CollisionCategories = Category.All & ~Category.Cat10; Body.CollidesWith = Category.All & ~Category.Cat10; CurrentAnim = LeftWalk; Body.BodyTypeName = "cow"; CowGameScreen.WordlsList.ForEach(worldInList => worldInList.ContactManager.Nearby += NearbyCow); }
public Stash(ref DrawEnvironment.Field field, Inventory.Inventory inventory, string name) : base(ref field, inventory, Color.CadetBlue) { this.name = name; }
/// <summary> /// Tells the rest of the game how to interact with this item /// </summary> /// <param name="playerInventory"></param> public override void InteractWithItem(Inventory.Inventory playerInventory) { OpenItemInvnetory(playerInventory); }
public override void UseItem(ItemData itemData, uint inventoryIndex, Inventory.Inventory inventory) { base.UseItem(itemData, inventoryIndex, inventory); // place grid PlayerManager.Instance.SetBuildMode(true, BuildableStructure.Id, this, inventoryIndex, inventory); }
private void OnEnable() { PlayerInput.Instance.HotkeyPressed += Handle_HotkeyPressed; _inventory = FindObjectOfType <Inventory.Inventory>(); _slots = GetComponentsInChildren <Slot>(); }
public virtual void UseItem(ItemData itemData, uint inventoryIndex, Inventory.Inventory inventory) { Debug.Log("Item.cs Use"); }
public void setInventory(Inventory.Inventory i) { this.inventory = i; }
public Dungeon.Model model; // protected public Creature(ref DrawEnvironment.Field field, Inventory.Inventory inventory, Color color, int hp, string name, Dungeon.Model m) : base(ref field, inventory, color) { this.hp = hp; this.name = name; this.model = m; }
public void UseItemLocal(Inventory.Inventory currentInventory, uint currentInventoryIndex) { currentInventory.LocalUseItem(currentInventoryIndex); }
public void DropInventorySlot(Inventory.Inventory currentInventory, uint currentInventoryIndex) { Inventory.CmdDropItem(currentInventory.netId, currentInventoryIndex); }
public void MoveInventorySlotsExternal(Inventory.Inventory currentInventory, uint currentInventoryIndex, uint targetInventoryIndex, uint targetInventoryNetId) { Inventory.CmdMoveItemExternal(currentInventoryIndex, targetInventoryIndex, currentInventory.netId, targetInventoryNetId); }
public void MoveInventorySlotsInternal(Inventory.Inventory currentInventory, uint currentInventoryIndex, uint targetInventoryIndex) { currentInventory.CmdMoveItemInternal(currentInventoryIndex, targetInventoryIndex); }
public virtual void Awake() { EntityTransform = transform; NetworkIdentity = GetComponent <NetworkIdentity>(); Inventory = GetComponent <Inventory.Inventory>(); }
private void Start() { _inventory = Instance; _anim = GetComponent <Animator>(); }
/// <summary> /// Toggles the <see cref="ApiaryInventory"/> for the block /// </summary> /// <param name="inv"></param> /// <returns></returns> public override bool InteractWithBlock(Inventory.Inventory inv) { myGameobject.GetComponent <ApiaryInventory>().myblock = this; myGameobject.GetComponent <ApiaryInventory>().ToggleInventory(inv); return(true); }
public Interactable(ref DrawEnvironment.Field field, Inventory.Inventory inventory, Color color) { this.position = field; this.inventory = inventory; this.color = color; }
public void FinishedUseItem(Inventory.Inventory currentInventory, uint currentInventoryIndex) { Inventory.CmdFinishedUseItem(currentInventory.netId, currentInventoryIndex); }
private void InventoryClosed(Inventory.Inventory inv) { DecreaseAllCounters(); }
public void FinishedUseBuildableItem(Inventory.Inventory currentInventory, uint currentInventoryIndex) { Inventory.CmdFinishedUseBuildableItem(currentInventory.netId, currentInventoryIndex, PlayerManager.Instance.BuildCursor.position); }
public virtual void InteractWithItem(Inventory.Inventory playerInventory) { return; }
public void SetInventory(Inventory.Inventory invetory) { _invetory = invetory; }
private void Start() { inv = GameObject.Find("Inventory").GetComponent <Inventory.Inventory>(); tooltip = inv.GetComponent <Tooltip>(); }
public void SetBuildMode(bool active, uint id, ItemBuildable item, uint inventoryIndex, Inventory.Inventory inventory) { BuildMode = active; CurrentBuildableItem = item; GameManager.StructureCursorDictionary.TryGetValue(id, out var structureCursor); structureCursor.InventoryIndex = inventoryIndex; structureCursor.Inventory = inventory; BuildStructure = structureCursor; }
public SearchableDetector(Inventory.Inventory inventory) { this.inventory = inventory; }
public override void Awake() { base.Awake(); Inventory = GetComponent <Inventory.Inventory>(); }