コード例 #1
0
ファイル: Character.cs プロジェクト: mrZmitser/CatFish
 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();
 }
コード例 #2
0
        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 }
            };
        }
コード例 #3
0
ファイル: Serialization.cs プロジェクト: maxs-rose/BeeGame
        /// <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}"));
        }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: Stash.cs プロジェクト: luchtele/Dungeon
 public Stash(ref DrawEnvironment.Field field, Inventory.Inventory inventory, string name) : base(ref field, inventory, Color.CadetBlue)
 {
     this.name = name;
 }
コード例 #6
0
ファイル: BeeAlyzer.cs プロジェクト: maxs-rose/BeeGame
 /// <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);
 }
コード例 #7
0
 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);
 }
コード例 #8
0
ファイル: Hotbar.cs プロジェクト: mbalrog6/Jason-RPG
 private void OnEnable()
 {
     PlayerInput.Instance.HotkeyPressed += Handle_HotkeyPressed;
     _inventory = FindObjectOfType <Inventory.Inventory>();
     _slots     = GetComponentsInChildren <Slot>();
 }
コード例 #9
0
ファイル: Item.cs プロジェクト: gresc574/ProjectExamples
 public virtual void UseItem(ItemData itemData, uint inventoryIndex, Inventory.Inventory inventory)
 {
     Debug.Log("Item.cs Use");
 }
コード例 #10
0
 public void setInventory(Inventory.Inventory i)
 {
     this.inventory = i;
 }
コード例 #11
0
        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;
        }
コード例 #12
0
 public void UseItemLocal(Inventory.Inventory currentInventory, uint currentInventoryIndex)
 {
     currentInventory.LocalUseItem(currentInventoryIndex);
 }
コード例 #13
0
 public void DropInventorySlot(Inventory.Inventory currentInventory, uint currentInventoryIndex)
 {
     Inventory.CmdDropItem(currentInventory.netId, currentInventoryIndex);
 }
コード例 #14
0
 public void MoveInventorySlotsExternal(Inventory.Inventory currentInventory, uint currentInventoryIndex, uint targetInventoryIndex, uint targetInventoryNetId)
 {
     Inventory.CmdMoveItemExternal(currentInventoryIndex, targetInventoryIndex, currentInventory.netId, targetInventoryNetId);
 }
コード例 #15
0
 public void MoveInventorySlotsInternal(Inventory.Inventory currentInventory, uint currentInventoryIndex, uint targetInventoryIndex)
 {
     currentInventory.CmdMoveItemInternal(currentInventoryIndex, targetInventoryIndex);
 }
コード例 #16
0
 public virtual void Awake()
 {
     EntityTransform = transform;
     NetworkIdentity = GetComponent <NetworkIdentity>();
     Inventory       = GetComponent <Inventory.Inventory>();
 }
コード例 #17
0
ファイル: Door.cs プロジェクト: chrisd1999/kontrarpg
 private void Start()
 {
     _inventory = Instance;
     _anim      = GetComponent <Animator>();
 }
コード例 #18
0
 /// <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);
 }
コード例 #19
0
 public Interactable(ref DrawEnvironment.Field field, Inventory.Inventory inventory, Color color)
 {
     this.position  = field;
     this.inventory = inventory;
     this.color     = color;
 }
コード例 #20
0
 public void FinishedUseItem(Inventory.Inventory currentInventory, uint currentInventoryIndex)
 {
     Inventory.CmdFinishedUseItem(currentInventory.netId, currentInventoryIndex);
 }
コード例 #21
0
 private void InventoryClosed(Inventory.Inventory inv)
 {
     DecreaseAllCounters();
 }
コード例 #22
0
 public void FinishedUseBuildableItem(Inventory.Inventory currentInventory, uint currentInventoryIndex)
 {
     Inventory.CmdFinishedUseBuildableItem(currentInventory.netId, currentInventoryIndex, PlayerManager.Instance.BuildCursor.position);
 }
コード例 #23
0
ファイル: Item.cs プロジェクト: maxs-rose/BeeGame
 public virtual void InteractWithItem(Inventory.Inventory playerInventory)
 {
     return;
 }
コード例 #24
0
 public void SetInventory(Inventory.Inventory invetory)
 {
     _invetory = invetory;
 }
コード例 #25
0
 private void Start()
 {
     inv     = GameObject.Find("Inventory").GetComponent <Inventory.Inventory>();
     tooltip = inv.GetComponent <Tooltip>();
 }
コード例 #26
0
 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;
 }
コード例 #27
0
 public SearchableDetector(Inventory.Inventory inventory)
 {
     this.inventory = inventory;
 }
コード例 #28
0
 public override void Awake()
 {
     base.Awake();
     Inventory = GetComponent <Inventory.Inventory>();
 }