Ejemplo n.º 1
0
        public override void AddHoldTiles(Direction direction)
        {
            int dir = GetValueForDirection(direction);

            GalleonHold gHold = AddGalleonHold(new GalleonHold(this, m_HoldItemIDs[dir][0]));

            HoldItem hold1 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][0]));
            HoldItem hold2 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][1]));
            HoldItem hold4 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][2]));
            HoldItem hold5 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][3]));
            HoldItem hold6 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][4]));

            switch (direction)
            {
            case Direction.North:
                hold1.Location = new Point3D(X - 1, Y + 5, Z);
                hold2.Location = new Point3D(X - 1, Y + 4, Z);

                gHold.Location = new Point3D(X, Y + 4, Z);

                hold4.Location = new Point3D(X + 1, Y + 4, Z);
                hold5.Location = new Point3D(X + 1, Y + 5, Z);
                hold6.Location = new Point3D(X, Y + 5, Z);
                break;

            case Direction.South:
                hold1.Location = new Point3D(X + 1, Y - 5, Z);
                hold2.Location = new Point3D(X + 1, Y - 4, Z);

                gHold.Location = new Point3D(X, Y - 4, Z);

                hold4.Location = new Point3D(X - 1, Y - 4, Z);
                hold5.Location = new Point3D(X - 1, Y - 5, Z);
                hold6.Location = new Point3D(X, Y - 5, Z);
                break;

            case Direction.East:
                hold1.Location = new Point3D(X - 5, Y - 1, Z);
                hold2.Location = new Point3D(X - 4, Y - 1, Z);

                gHold.Location = new Point3D(X - 4, Y, Z);

                hold4.Location = new Point3D(X - 4, Y + 1, Z);
                hold5.Location = new Point3D(X - 5, Y + 1, Z);
                hold6.Location = new Point3D(X - 5, Y, Z);
                break;

            case Direction.West:
                hold1.Location = new Point3D(X + 5, Y + 1, Z);
                hold2.Location = new Point3D(X + 4, Y + 1, Z);

                gHold.Location = new Point3D(X + 4, Y, Z);

                hold4.Location = new Point3D(X + 4, Y - 1, Z);
                hold5.Location = new Point3D(X + 5, Y - 1, Z);
                hold6.Location = new Point3D(X + 5, Y, Z);
                break;
            }
        }
Ejemplo n.º 2
0
	public void initializePlayer() {
		inventoryBarController = GameObject.Find ("InventoryBar").GetComponent<InventoryBarController>() as InventoryBarController;

		leftHandHoldItem = leftHand.GetComponent<HoldItem> () as HoldItem;
		rightHandHoldItem = rightHand.GetComponent<HoldItem> () as HoldItem;

		rightHandHoldItem.generate3DMesh (inventoryBarController.getItem (0));
	}
Ejemplo n.º 3
0
    public void initializePlayer()
    {
        inventoryBarController = GameObject.Find("InventoryBar").GetComponent <InventoryBarController>() as InventoryBarController;

        leftHandHoldItem  = leftHand.GetComponent <HoldItem> () as HoldItem;
        rightHandHoldItem = rightHand.GetComponent <HoldItem> () as HoldItem;

        rightHandHoldItem.generate3DMesh(inventoryBarController.getItem(0));
    }
Ejemplo n.º 4
0
    public ItemList(XmlReader reader)
    {
        while (reader.Read())
        {
            if (reader.NodeType == XmlNodeType.Element && reader.Name == "inventoryItem")
            {
                int           type = int.Parse(reader.GetAttribute("Type"));
                inventoryItem item; //can be overwritten by the switch

                # region switch (type)
                switch (type)
                {
                case 1:     //medicine
                    item = new RecoveryItem();
                    break;

                case 2:     //pokeball
                    item       = new Pokeball();
                    item.Power = double.Parse(reader.GetAttribute("Power"));
                    break;

                case 3:     //TM
                    item = new TMItem();
                    break;

                case 4:     //berry
                    item = new Berry();
                    break;

                case 5:                    //holdable item
                    //item = new MainItem();
                    item = new HoldItem(); //still returns "MainItem"";
                    break;

                case 6:     //key item
                    item = new KeyItem();
                    break;

                default:
                    item = new inventoryItem();
                    break;
                }
                # endregion

                item.ID          = reader.GetAttribute("ID");
                item.Name        = reader.GetAttribute("Name");
                item.type        = type;
                item.Description = reader.ReadElementString();

                items.Add(item.ID, item);
            }
Ejemplo n.º 5
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            if (version == 0)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(30), () =>
                {
                    foreach (var tile in FillerTiles)
                    {
                        var holdItem = new HoldItem(GalleonHold, tile.ItemID);
                        holdItem.MoveToWorld(tile.Location, tile.Map);
                        AddHoldTile(holdItem);

                        tile.Delete();
                    }

                    FillerTiles.Clear();
                });
            }
        }
    private bool removed;              //a flag for if the player removes the object


    // Start is called before the first frame update
    void Start()
    {
        currentItem = null;
        holdItem    = gameObject.GetComponent <HoldItem>();
        removed     = false;
    }
Ejemplo n.º 7
0
        public override void AddHoldTiles(Direction direction)
        {
            int dir = GetValueForDirection(direction);

            GalleonHold gHold = AddGalleonHold(new GalleonHold(this, m_HoldItemIDs[dir][0]));

            HoldItem hold1 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][0]));
            HoldItem hold2 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][1]));
            HoldItem hold3 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][2]));
            HoldItem hold4 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][3]));
            HoldItem hold5 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][4]));
            HoldItem hold6 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][5]));
            HoldItem hold7 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][6]));
            HoldItem hold8 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][7]));
            HoldItem hold9 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][8]));

            HoldItem fill1  = AddHoldTile(new HoldItem(GalleonHold, m_FillerIDs[dir][0]));
            HoldItem fill2  = AddHoldTile(new HoldItem(GalleonHold, m_FillerIDs[dir][1]));
            HoldItem fill3  = AddHoldTile(new HoldItem(GalleonHold, m_FillerIDs[dir][2]));
            HoldItem fill4  = AddHoldTile(new HoldItem(GalleonHold, m_FillerIDs[dir][3]));
            HoldItem fill6  = AddHoldTile(new HoldItem(GalleonHold, m_FillerIDs[dir][4]));
            HoldItem fill7  = AddHoldTile(new HoldItem(GalleonHold, m_FillerIDs[dir][5]));
            HoldItem fill8  = AddHoldTile(new HoldItem(GalleonHold, m_FillerIDs[dir][6]));
            HoldItem fill9  = AddHoldTile(new HoldItem(GalleonHold, m_FillerIDs[dir][7]));
            HoldItem fill10 = AddHoldTile(new HoldItem(GalleonHold, m_FillerIDs[dir][8]));
            HoldItem fill11 = AddHoldTile(new HoldItem(GalleonHold, m_FillerIDs[dir][9]));

            switch (direction)
            {
            case Direction.North:
                hold1.Location = new Point3D(X - 1, Y + 8, Z);
                hold2.Location = new Point3D(X, Y + 8, Z);
                hold3.Location = new Point3D(X + 1, Y + 8, Z);
                hold4.Location = new Point3D(X + 1, Y + 7, Z);
                hold5.Location = new Point3D(X, Y + 7, Z);
                hold6.Location = new Point3D(X - 1, Y + 7, Z);
                hold7.Location = new Point3D(X + 1, Y + 6, Z);
                hold8.Location = new Point3D(X - 1, Y + 6, Z);
                hold9.Location = new Point3D(X, Y + 6, Z);

                fill1.Location = new Point3D(X - 2, Y + 8, Z);
                fill2.Location = new Point3D(X - 2, Y + 7, Z);
                fill3.Location = new Point3D(X - 2, Y + 6, Z);
                fill4.Location = new Point3D(X - 2, Y + 5, Z);

                gHold.Location = new Point3D(X, Y + 5, Z);

                fill6.Location  = new Point3D(X - 1, Y + 5, Z);
                fill7.Location  = new Point3D(X + 1, Y + 5, Z);
                fill8.Location  = new Point3D(X + 2, Y + 5, Z);
                fill9.Location  = new Point3D(X + 2, Y + 6, Z);
                fill10.Location = new Point3D(X + 2, Y + 7, Z);
                fill11.Location = new Point3D(X + 2, Y + 8, Z);
                break;

            case Direction.South:
                hold1.Location = new Point3D(X + 1, Y - 8, Z);
                hold2.Location = new Point3D(X, Y - 8, Z);
                hold3.Location = new Point3D(X - 1, Y - 8, Z);
                hold4.Location = new Point3D(X - 1, Y - 7, Z);
                hold5.Location = new Point3D(X, Y - 7, Z);
                hold6.Location = new Point3D(X + 1, Y - 7, Z);
                hold7.Location = new Point3D(X - 1, Y - 6, Z);
                hold8.Location = new Point3D(X + 1, Y - 6, Z);
                hold9.Location = new Point3D(X, Y - 6, Z);

                fill1.Location = new Point3D(X + 2, Y - 8, Z);
                fill2.Location = new Point3D(X + 2, Y - 7, Z);
                fill3.Location = new Point3D(X + 2, Y - 6, Z);
                fill4.Location = new Point3D(X + 2, Y - 5, Z);

                gHold.Location = new Point3D(X, Y - 5, Z);

                fill6.Location  = new Point3D(X + 1, Y - 5, Z);
                fill7.Location  = new Point3D(X - 1, Y - 5, Z);
                fill8.Location  = new Point3D(X - 2, Y - 5, Z);
                fill9.Location  = new Point3D(X - 2, Y - 6, Z);
                fill10.Location = new Point3D(X - 2, Y - 7, Z);
                fill11.Location = new Point3D(X - 2, Y - 8, Z);
                break;

            case Direction.East:
                hold1.Location = new Point3D(X - 8, Y - 1, Z);
                hold2.Location = new Point3D(X - 8, Y, Z);
                hold3.Location = new Point3D(X - 8, Y + 1, Z);
                hold4.Location = new Point3D(X - 7, Y - 1, Z);
                hold5.Location = new Point3D(X - 7, Y, Z);
                hold6.Location = new Point3D(X - 7, Y + 1, Z);
                hold7.Location = new Point3D(X - 6, Y + 1, Z);
                hold8.Location = new Point3D(X - 6, Y - 1, Z);
                hold9.Location = new Point3D(X - 6, Y, Z);

                fill1.Location = new Point3D(X - 8, Y - 2, Z);
                fill2.Location = new Point3D(X - 7, Y - 2, Z);
                fill3.Location = new Point3D(X - 6, Y - 2, Z);
                fill4.Location = new Point3D(X - 5, Y - 2, Z);

                gHold.Location = new Point3D(X - 5, Y, Z);

                fill6.Location  = new Point3D(X - 5, Y - 1, Z);
                fill7.Location  = new Point3D(X - 5, Y + 1, Z);
                fill8.Location  = new Point3D(X - 5, Y + 2, Z);
                fill9.Location  = new Point3D(X - 6, Y + 2, Z);
                fill10.Location = new Point3D(X - 7, Y + 2, Z);
                fill11.Location = new Point3D(X - 8, Y + 2, Z);
                break;

            case Direction.West:
                hold1.Location = new Point3D(X + 8, Y + 1, Z);
                hold2.Location = new Point3D(X + 8, Y, Z);
                hold3.Location = new Point3D(X + 8, Y - 1, Z);
                hold4.Location = new Point3D(X + 7, Y + 1, Z);
                hold5.Location = new Point3D(X + 7, Y, Z);
                hold6.Location = new Point3D(X + 7, Y - 1, Z);
                hold7.Location = new Point3D(X + 6, Y - 1, Z);
                hold8.Location = new Point3D(X + 6, Y + 1, Z);
                hold9.Location = new Point3D(X + 6, Y, Z);

                fill1.Location = new Point3D(X + 8, Y + 2, Z);
                fill2.Location = new Point3D(X + 7, Y + 2, Z);
                fill3.Location = new Point3D(X + 6, Y + 2, Z);
                fill4.Location = new Point3D(X + 5, Y + 2, Z);

                gHold.Location = new Point3D(X + 5, Y, Z);

                fill6.Location  = new Point3D(X + 5, Y + 1, Z);
                fill7.Location  = new Point3D(X + 5, Y - 1, Z);
                fill8.Location  = new Point3D(X + 5, Y - 2, Z);
                fill9.Location  = new Point3D(X + 6, Y - 2, Z);
                fill10.Location = new Point3D(X + 7, Y - 2, Z);
                fill11.Location = new Point3D(X + 8, Y - 2, Z);
                break;
            }
        }
Ejemplo n.º 8
0
        public override void AddHoldTiles(Direction direction)
        {
            int dir = GetValueForDirection(direction);

            GalleonHold gHold = AddGalleonHold(new GalleonHold(this, m_HoldItemIDs[dir][0]));

            HoldItem hold1 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][0]));
            HoldItem hold2 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][1]));
            HoldItem hold3 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][2]));
            HoldItem hold4 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][3]));
            HoldItem hold5 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][4]));
            HoldItem hold6 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][5]));
            HoldItem hold7 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][6]));
            HoldItem hold8 = AddHoldTile(new HoldItem(GalleonHold, m_HoldIDs[dir][7]));

            Static fill1 = AddFillerTile(new Static(m_FillerIDs[dir][0]));
            Static fill2 = AddFillerTile(new Static(m_FillerIDs[dir][1]));
            Static fill3 = AddFillerTile(new Static(m_FillerIDs[dir][2]));

            AddAddonTile(fill2);
            AddAddonTile(fill3);

            switch (direction)
            {
            case Direction.North:
                gHold.Location = new Point3D(X, Y + 8, Z);
                hold1.Location = new Point3D(X + 1, Y + 8, Z);
                hold2.Location = new Point3D(X - 1, Y + 8, Z);
                hold3.Location = new Point3D(X + 1, Y + 9, Z);
                hold4.Location = new Point3D(X - 1, Y + 9, Z);
                hold5.Location = new Point3D(X, Y + 10, Z);
                hold6.Location = new Point3D(X + 1, Y + 10, Z);
                hold7.Location = new Point3D(X - 1, Y + 10, Z);
                hold8.Location = new Point3D(X, Y + 9, Z);

                fill1.Location = new Point3D(X, Y - 3, Z);
                fill2.Location = new Point3D(X, Y + 13, Z);
                fill3.Location = new Point3D(X, Y + 16, Z);
                break;

            case Direction.South:
                gHold.Location = new Point3D(X, Y - 8, Z);
                hold1.Location = new Point3D(X - 1, Y - 8, Z);
                hold2.Location = new Point3D(X + 1, Y - 8, Z);
                hold3.Location = new Point3D(X - 1, Y - 9, Z);
                hold4.Location = new Point3D(X + 1, Y - 9, Z);
                hold5.Location = new Point3D(X, Y - 10, Z);
                hold6.Location = new Point3D(X - 1, Y - 10, Z);
                hold7.Location = new Point3D(X + 1, Y - 10, Z);
                hold8.Location = new Point3D(X, Y - 9, Z);

                fill1.Location = new Point3D(X, Y + 3, Z);
                fill2.Location = new Point3D(X, Y - 13, Z);
                fill3.Location = new Point3D(X, Y - 16, Z);
                break;

            case Direction.East:
                gHold.Location = new Point3D(X - 8, Y, Z);
                hold1.Location = new Point3D(X - 8, Y + 1, Z);
                hold2.Location = new Point3D(X - 8, Y - 1, Z);
                hold3.Location = new Point3D(X - 9, Y + 1, Z);
                hold4.Location = new Point3D(X - 9, Y - 1, Z);
                hold5.Location = new Point3D(X - 10, Y, Z);
                hold6.Location = new Point3D(X - 10, Y + 1, Z);
                hold7.Location = new Point3D(X - 10, Y - 1, Z);
                hold8.Location = new Point3D(X - 9, Y, Z);

                fill1.Location = new Point3D(X + 3, Y, Z);
                fill2.Location = new Point3D(X - 13, Y, Z);
                fill3.Location = new Point3D(X - 16, Y, Z);
                break;

            case Direction.West:
                gHold.Location = new Point3D(X + 8, Y, Z);
                hold1.Location = new Point3D(X + 8, Y - 1, Z);
                hold2.Location = new Point3D(X + 8, Y + 1, Z);
                hold3.Location = new Point3D(X + 9, Y - 1, Z);
                hold4.Location = new Point3D(X + 9, Y + 1, Z);
                hold5.Location = new Point3D(X + 10, Y, Z);
                hold6.Location = new Point3D(X + 10, Y - 1, Z);
                hold7.Location = new Point3D(X + 10, Y + 1, Z);
                hold8.Location = new Point3D(X + 9, Y, Z);

                fill1.Location = new Point3D(X - 3, Y, Z);
                fill2.Location = new Point3D(X + 13, Y, Z);
                fill3.Location = new Point3D(X + 16, Y, Z);
                break;
            }
        }
Ejemplo n.º 9
0
    public static void generate3DMeshFromBlock(GameObject g, Block block)
    {
        HoldItem holdItem = g.AddComponent <HoldItem> () as HoldItem;

        holdItem.generate3DMesh(block);
    }