Ejemplo n.º 1
0
 public Inventory(Texture2D inventoryTex, int inventoryX, int inventoryY)
 {
     //PLAYER INVENTORY
     this.invTex = inventoryTex;
     thisInventory = new Item[inventoryX, inventoryY];
     currentItem = Vector2.Zero;
 }
Ejemplo n.º 2
0
    public CraftingSystem()
    {
        itemArray = new Item[GRID_SIZE, GRID_SIZE];

        recipeDictionary = new Dictionary <Item.ItemType, Item.ItemType[, ]>();

        // Stick
        Item.ItemType[,] recipe = new Item.ItemType[GRID_SIZE, GRID_SIZE];
        recipe[0, 2]            = Item.ItemType.None;     recipe[1, 2] = Item.ItemType.None;     recipe[2, 2] = Item.ItemType.None;
        recipe[0, 1]            = Item.ItemType.None;     recipe[1, 1] = Item.ItemType.Wood;     recipe[2, 1] = Item.ItemType.None;
        recipe[0, 0]            = Item.ItemType.None;     recipe[1, 0] = Item.ItemType.Wood;     recipe[2, 0] = Item.ItemType.None;
        recipeDictionary[Item.ItemType.Stick] = recipe;

        // Wooden Sword
        recipe       = new Item.ItemType[GRID_SIZE, GRID_SIZE];
        recipe[0, 2] = Item.ItemType.None;     recipe[1, 2] = Item.ItemType.Wood;      recipe[2, 2] = Item.ItemType.None;
        recipe[0, 1] = Item.ItemType.None;     recipe[1, 1] = Item.ItemType.Wood;      recipe[2, 1] = Item.ItemType.None;
        recipe[0, 0] = Item.ItemType.None;     recipe[1, 0] = Item.ItemType.Stick;     recipe[2, 0] = Item.ItemType.None;
        recipeDictionary[Item.ItemType.Sword_Wood] = recipe;

        // Diamond Sword
        recipe       = new Item.ItemType[GRID_SIZE, GRID_SIZE];
        recipe[0, 2] = Item.ItemType.None;     recipe[1, 2] = Item.ItemType.Diamond;     recipe[2, 2] = Item.ItemType.None;
        recipe[0, 1] = Item.ItemType.None;     recipe[1, 1] = Item.ItemType.Diamond;     recipe[2, 1] = Item.ItemType.None;
        recipe[0, 0] = Item.ItemType.None;     recipe[1, 0] = Item.ItemType.Stick;       recipe[2, 0] = Item.ItemType.None;
        recipeDictionary[Item.ItemType.Sword_Diamond] = recipe;
    }
Ejemplo n.º 3
0
    public static void InitializatePlayers()
    {
        position        = new int[4];
        direction       = new int[4];
        haddocks        = new int[4];
        items           = new Item[4, 3];
        numItems        = new int[4];
        buttonsItems    = new GameObject[3];
        buttonsItems[0] = GameObject.Find("ButtonItem1");
        buttonsItems[1] = GameObject.Find("ButtonItem2");
        buttonsItems[2] = GameObject.Find("ButtonItem3");

        for (int numPlayer = 0; numPlayer < 4; numPlayer++)
        {
            position[numPlayer]  = 0;
            direction[numPlayer] = 1;
            haddocks[numPlayer]  = 0;

            for (int numItem = 0; numItem < 3; numItem++)
            {
                items[numPlayer, numItem] = Item.Empty;
            }
            numItems[numPlayer] = 0;
        }
    }
Ejemplo n.º 4
0
    protected Inventory(int width, int height)
    {
        _width  = width;
        _height = height;

        items = new Item[_width, _height];
    }
Ejemplo n.º 5
0
 public Inventory(int inventoryX, int inventoryY)
 {
     //NPC INVENTORY
     this.invTex = null;
     thisInventory = new Item[inventoryX, inventoryY];
     currentItem = Vector2.Zero;
 }
Ejemplo n.º 6
0
    public void refreshGridpositions()
    {
        Item [,] itemMap = GameManager.instance.itemMap;
        this.gridPositions.Clear();

        // exclude exit, exclude player position
        int exitx = itemMap.GetLength(0) - 1;
        int exity = itemMap.GetLength(1) - 1;
        int px    = (int)(GameManager.instance.player.transform.position.x / BoardManager.wMultiplier);
        int py    = (int)(GameManager.instance.player.transform.position.y / BoardManager.hMultiplier);

        for (int i = 0; i < itemMap.GetLength(0); i++)
        {
            for (int j = 0; j < itemMap.GetLength(1); j++)
            {
                if (!(i == exitx && j == exity) && !(i == px && j == py))
                {
                    if (itemMap[i, j] == null)
                    {
                        gridPositions.Add(new Vector3(i * wMultiplier, j * hMultiplier, 0f));
                    }
                }
            }
        }
    }
Ejemplo n.º 7
0
 public Inventory(int nbColumns, int nbLines)
 {
     this.nbColumns = nbColumns;
     this.nbLines   = nbLines;
     items          = new Item[nbColumns, nbLines];
     isOpen         = false;
 }
Ejemplo n.º 8
0
        public void Rotate(Item[,] field)
        {
            int oldRotation = _rotation;

            if (++_rotation >= Rotations)
            {
                _rotation = 0;
            }
            int oldX = _position.X;

            if (Intersects(field))
            {
                if (_position.X < Game.Width / 2)
                {
                    _position.X += 1;
                }
                else
                {
                    _position.X -= 1;
                }
            }
            if (Intersects(field))
            {
                _position.X = oldX;
                _rotation   = oldRotation;
            }
        }
Ejemplo n.º 9
0
 private void Start()
 {
     startGameEvent?.Invoke();
     CreateGameField(grid.SizeGrid);
     items    = grid.grid;
     sizeGrid = grid.SizeGrid;
 }
Ejemplo n.º 10
0
 public void SetWorldSize(int width, int height)
 {
     Width   = width;
     Height  = height;
     tileMap = new Tile[Width, Height];
     items   = new Item[Width, Height];
 }
Ejemplo n.º 11
0
        private static Node[,] BuildNodes(Item[,] matrix)
        {
            int height = matrix.GetLength(0);
            int width  = matrix.GetLength(1);

            Node[,] nodes = new Node[height, width];

            for (int rowIndex = 0; rowIndex < height; rowIndex++)
            {
                for (int colIndex = 0; colIndex < width; colIndex++)
                {
                    if (matrix[rowIndex, colIndex].Type.CompareTo(ItemType.Nothing) == 0 ||
                        matrix[rowIndex, colIndex].Type.CompareTo(ItemType.AISpawnPoint) == 0 ||
                        matrix[rowIndex, colIndex].Type.CompareTo(ItemType.PlayerSpawnPoint) == 0 ||
                        matrix[rowIndex, colIndex].Type.CompareTo(ItemType.Forrest) == 0)
                    {
                        nodes[rowIndex, colIndex] = new Node(rowIndex, colIndex, true);
                    }
                    else
                    {
                        nodes[rowIndex, colIndex] = new Node(rowIndex, colIndex, false);
                    }
                }
            }

            return(nodes);
        }
Ejemplo n.º 12
0
        public HourSelector()
        {
            InitializeComponent();
            bmpControl = null;

            CountClockChecked = 0;

            clocks = new Item[6, 4];
            bool check = true;

            for (int i = 0; i < 24; i++)
            {
                Item item = new Item(
                    String.Format("{0:D2}", i),
                    i % 6, i / 6, check
                    );
                clocks[i % 6, i / 6] = item;
                if (item.Check)
                {
                    CountClockChecked++;
                }
                if (DesignMode)
                {
                    check = !check;
                }
            }
        }
Ejemplo n.º 13
0
        public bool Intersects(Item[,] field)
        {
            var matrix = _figures;

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    if (matrix[_currentFigure, _rotation, i, j] == 1 && _position.X + i < 0)
                    {
                        return(true);
                    }
                    if (matrix[_currentFigure, _rotation, i, j] == 1 &&
                        _position.X + i >= Game.Width)
                    {
                        return(true);
                    }
                    if (_position.X + i >= Game.Width || _position.X + i < 0 ||
                        _position.Y - j >= Game.Height || _position.Y - j < 0)
                    {
                        continue;
                    }
                    if (matrix[_currentFigure, _rotation, i, j] == 1 &&
                        field[_position.X + i, _position.Y - j] != null)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 14
0
 public static void Print(Item[,] layout)
 {
     for (int y = 2; y >= 0; y--)
     {
         Debug.Log(((layout[y, 0] == null) ? "0" : layout[y, 0].ToString()) + " " + ((layout[y, 1] == null) ? "0" : layout[y, 1].ToString()) + " " + ((layout[y, 2] == null) ? "0" : layout[y, 2].ToString()));
     }
 }
Ejemplo n.º 15
0
        public void AddValue(uint key, T value)
        {
            Action <uint> registerIndexHandler = (i) =>
            {
                _loadedIndexes.Add(i);
                _loaded++;
            };


            var index = AddValue(_values, _length, _depth, key, value);

            if (index != uint.MaxValue)
            {
                registerIndexHandler(index);
                return;
            }

            var loadFactor     = (double)_loaded / (_length * _depth);
            var loadFactorStep = LoadFactorStep;
            var newLength      = _length;

            Item[,] newValues;
            var  newIndexes = new List <uint>();
            bool rebuilt;

            do
            {
                if (loadFactor < MinimalLoadFactor)
                {
                    throw new InvalidOperationException("Could not rebuild the values");
                }

                while (loadFactor <= loadFactorStep)
                {
                    loadFactorStep *= loadFactorStep;
                }
                loadFactor -= loadFactorStep;
                if (newLength < LengthTreshold)
                {
                    newLength = Convert.ToUInt32(_loaded / loadFactor / _depth);
                }
                else
                {
                    _depth++;
                }
                newValues = new Item[newLength, _depth];
                newIndexes.Clear();
                rebuilt = Rebuild(_values, newValues, newLength, _depth, _loadedIndexes, newIndexes);
                if (rebuilt)
                {
                    index = AddValue(newValues, newLength, _depth, key, value);
                }
            } while (index == uint.MaxValue || !rebuilt);

            _values        = newValues;
            _loadedIndexes = newIndexes;
            _length        = newLength;
            registerIndexHandler(index);
        }
Ejemplo n.º 16
0
 void Start()
 {
     inventory = new Item[slotsX, slotsY]; //initialize array
     itemCount = 0;
     AddItemToInv(0);                      //add items to array
     AddItemToInv(1);
     DrawInventoryGUI();                   //draw Inventory (starts disabled though)
 }
Ejemplo n.º 17
0
        private int userAmount;                // Field to keep track of the user's money

        // Parameterized constructor
        public VendingMachine(Item[,] items)
        {
            this._shelve            = items;
            this._machineDisplay    = new Display();
            this._machineTransactor = new Transactor();
            this._machineKeypad     = new KeyPad();
            this.userAmount         = 0;
        }
Ejemplo n.º 18
0
 private void InitializeGame()
 {
     _field = new Item[Width, Height];
     _block = new Block();
     _block.Generate();
     _total             = 0;
     _linesSent.Content = "0";
 }
Ejemplo n.º 19
0
 /// <summary>
 /// 컴포넌트가 움직인 위치에 컴포넌트가 있는지 확인
 /// </summary>
 bool MoveItem(Item[,] component, Point point, Item item)
 {
     if (component[point.X, point.Y] == item)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 20
0
 public void MoveRight(Item[,] field)
 {
     _position.X += 1;
     if (Intersects(field))
     {
         _position.X -= 1;
     }
 }
Ejemplo n.º 21
0
 void Awake()
 {
     instance      = this;
     allItems      = new Item[tableRow, tableColumn];
     allPos        = new Vector3[tableRow, tableColumn];
     sameItemsList = new List <Item> ();
     boomList      = new List <Item> ();
 }
Ejemplo n.º 22
0
 public AdaptiveHashtable(uint length, uint depth)
 {
     _length        = length;
     _depth         = depth;
     _values        = new Item[_length, _depth];
     _loaded        = 0;
     _loadedIndexes = new List <uint>();
 }
Ejemplo n.º 23
0
 public Main()
 {
     InitializeComponent();
     rows = 20; cols = 30;
     area = new Item[rows, cols];
     makeEmpty();
     gamer = new Gamer(19, 15);
 }
Ejemplo n.º 24
0
        public Grid(int width, int height)
        {
            this.Width  = width;
            this.Height = height;

            m_Tiles = new Tile[width, height];
            m_Items = new Item[width, height];
        }
Ejemplo n.º 25
0
        internal Inventory(int columns, int slotCount)
        {
            int slotsX = columns;
            int slotsY = slotCount / columns;

            Slots = new Item[slotsY, slotsX];
            items = new List <Item>();
        }
Ejemplo n.º 26
0
 public VendingMachine(Item[,] items)
 {
     _shelve        = items;
     _displayScreen = new Display();
     _transactor    = new Transactor();
     _keypad        = new KeyPad();
     _userAmount    = 0;
 }
Ejemplo n.º 27
0
 private void Awake()
 {
     instance        = this;
     allItems        = new Item[tableRow, tableColum];
     allPos          = new Vector3[tableRow, tableColum];
     sameItemList    = new List <Item>();
     eliminationList = new List <Item>();
 }
Ejemplo n.º 28
0
 private void Awake()
 {
     Instance     = this;
     allItems     = new Item[Row, Col];
     allPos       = new Vector2[Row, Col];
     sameItemList = new List <Item>();
     boomList     = new List <Item>();
 }
Ejemplo n.º 29
0
        internal Inventory(int columns, int slotCount)
        {
            int slotsX = columns;
            int slotsY = slotCount / columns;

            Slots = new Item[slotsY, slotsX];
            items = new List<Item>();
        }
Ejemplo n.º 30
0
    public void Clear()
    {
        inventory = new Item[5, 6];

        foreach (ItemsRawWidget raw in raws)
        {
            raw.Clear();
        }
    }
Ejemplo n.º 31
0
 // Start is called before the first frame update
 void Start()
 {
     grid      = new int[width, height];
     slots     = new GameObject[width, height];
     items     = new Item[width, height];
     rootItems = new int[width, height];
     slotIds   = new int[width, height];
     SetupSlots();
 }
Ejemplo n.º 32
0
        public InventoryPocketNormal(Pocket pocket, int width, int height)
            : base(pocket)
        {
            _items = new Dictionary <long, Item>();
            _map   = new Item[width, height];

            _width  = width;
            _height = height;
        }
Ejemplo n.º 33
0
 public Map(int m, int n)
 {
     state = new Item[m, n];
     M = m; N = n; X = 0; Y = 0;
     Score = 0; LambdasLeft = 0; LambdasCollected = 0;
     Water = 0; Flooding = 0; Waterproof = 10;
     State = RobotState.Mining;
     TurnsUnderWater = 0; TurnNumber = 0;
     LinkedOutPoints = new Dictionary<Item, KeyValuePair<Point, List<Point>>>();
 }
Ejemplo n.º 34
0
    /*// Use this for initialization
     * void Start () {
     *
     *  Time.fixedDeltaTime = 0.25f;
     *
     *  inventory = new List<Item>();
     *
     *  grid = new Item[gridSize, gridSize];
     *
     *  maxInventorySize = gridSize * gridSize;
     *
     *  currentIndex = new int[2];
     *
     * }
     *
     * // Update is called once per frame
     * void FixedUpdate () {
     *
     *  if (createItem) {
     *
     *      createItem = false;
     *
     *      Item item = new Item(itemImage, itemName, itemQuantity);
     *
     *      AddItem(item);
     *
     *  }
     *
     *  if (updateItem) {
     *
     *      updateItem = false;
     *
     *      Item item = FindItemByName(selectedItem);
     *
     *      UpdateItem(item, itemImage, itemName, itemQuantity);
     *
     *  }
     *
     *  if (removeItem) {
     *
     *      removeItem = false;
     *
     *      Item item = FindItemByName(selectedItem);
     *
     *      DeleteItem(item);
     *
     *  }
     *
     *  if (emptyInventory) {
     *
     *      emptyInventory = false;
     *
     *      EmptyInventory();
     *
     *  }
     *
     *  if (printInventory) {
     *
     *      printInventory = false;
     *
     *      PrintInventory();
     *
     *  }
     *
     * }*/

    public Inventory()
    {
        inventory = new List <Item>();

        grid = new Item[gridSize, gridSize];

        maxInventorySize = gridSize * gridSize;

        currentIndex = new int[2];
    }
Ejemplo n.º 35
0
        public CollisionGrid(String filename, Texture2D active, Texture2D passive, Texture2D platformTexture)
        {
            using (System.IO.StreamReader file = new System.IO.StreamReader(filename))
            {
                int width = int.Parse(file.ReadLine());
                int height = int.Parse(file.ReadLine());

                _width = width;
                _height = height;
                _blocks = new Item[width, height];

                Point index;
                for (index.X = 0; index.X < width; index.X++)
                {
                    for (index.Y = 0; index.Y < height; index.Y++)
                    {
                        String objectName = file.ReadLine();
                        if (objectName.CompareTo("Teraform.Block") == 0)
                        {
                            _blocks[index.X, index.Y] = new Block(new Point(index.X * 16, index.Y * 16), active, Item.ITEM_STATE.IN_GRID);
                            _blocks[index.X, index.Y]._itemId = 2;

                        }
                        if (objectName.CompareTo("Teraform.Platform") == 0)
                        {
                            _blocks[index.X, index.Y] = new Platform(new Point(index.X * 16, index.Y * 16), platformTexture, Item.ITEM_STATE.IN_GRID);
                            _blocks[index.X, index.Y]._itemId = 1;
                        }

                        if (objectName.CompareTo("1") == 0)
                        {
                            Item item = Game.itemCatalog.GetItem(1);
                            item._drawLocation.X = index.X * 16;
                            item._drawLocation.Y = index.Y * 16;
                            item.ItemState = Item.ITEM_STATE.IN_GRID;
                            _blocks[index.X, index.Y] = item;

                        }
                        if (objectName.CompareTo("2") == 0)
                        {

                            Item item = Game.itemCatalog.GetItem(2);
                            item._drawLocation.X = index.X * 16;
                            item._drawLocation.Y = index.Y * 16;
                            item.ItemState = Item.ITEM_STATE.IN_GRID;
                            _blocks[index.X, index.Y] = item;
                        }

                    }
                }
                file.Close();
            }
        }
Ejemplo n.º 36
0
        public Map(String name, int level)
        {
            rand = new Random();

            this.name = name;
            this.terrain = new byte[45, 40];
            this.items = new Item[45, 40];
            this.tcodMap = new TCODMap(45, 40);
            this.monsters = new ArrayList();
            this.level = level;

            generateTerrainMap();
            generateTCODMap();
            generateMonsters();
            generateItems();

            this.trans = new Transision(rand.Next(1, 44), rand.Next(1 , 39));
        }
Ejemplo n.º 37
0
 /// <summary>
 /// Creates a ItemMap
 /// </summary>
 public ItemMap()
 {
     itemMap = new Item[Settings.getMapSizeX(), Settings.getMapSizeZ()];
 }
Ejemplo n.º 38
0
		public InventoryPocketNormal(Pocket pocket, int width, int height)
			: base(pocket)
		{
			_items = new Dictionary<long, Item>();
			_map = new Item[width, height];

			_width = width;
			_height = height;
		}
Ejemplo n.º 39
0
 //TODO fix texture loading so this isn't needed, it's really dumb
 public CollisionGrid(int width, int height)
 {
     _width = width;
     _height = height;
     _blocks = new Item[width, height];
 }
Ejemplo n.º 40
0
 public ItemBoard(int boardHeight,int boardWidth)
 {
     itemArray = new Item[boardHeight, boardWidth];
 }