Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 public void ItemInfoField(bool on, IItem item)
 {
     if (!itemDescription1)
     {
         itemDescription1 = (Instantiate(descriptionFieldPrefab) as GameObject).GetComponent <ItemInfoField> ();
         itemDescription1.GetComponent <RectTransform>().SetParent(GuiInventory.GetComponent <RectTransform>().parent);
         itemDescription2 = (Instantiate(descriptionFieldPrefab) as GameObject).GetComponent <ItemInfoField> ();
         itemDescription2.GetComponent <RectTransform>().SetParent(GuiInventory.GetComponent <RectTransform>().parent);
         itemDescription1.gameObject.SetActive(false);
         itemDescription2.gameObject.SetActive(false);
     }
     if (on && item != null)
     {
         if (!itemDescription1.gameObject.activeSelf)
         {
             itemDescription1.gameObject.SetActive(true);
         }
         float xPositionForNext = itemDescription1.DescriptionOn(Input.mousePosition, item);
         if (item is Equipment)
         {
             IItem temp = guiGear.GetEquipment(item.Type);
             if (temp != null && temp != item)
             {
                 itemDescription2.gameObject.SetActive(true);
                 itemDescription2.DescriptionOn(new Vector3(xPositionForNext, Input.mousePosition.y, Input.mousePosition.z), temp);
             }
         }
     }
     else
     {
         itemDescription1.gameObject.SetActive(false);
         itemDescription2.gameObject.SetActive(false);
     }
 }
Ejemplo n.º 2
0
 public Player(Vector2 spawnPoint, string username, GuiInventory inventory)
     : base(new Rectangle((int) spawnPoint.X, (int) spawnPoint.Y, Tile.Tile_Width, Tile.Tile_Width * 2), Textures.EntityPlayer, 1, 2.8f, true, Tile.Tile_Width + 10)
 {
     this.username = username;
     this.spawnPoint = spawnPoint;
     this.inventory = inventory;
     hotbar = new HotBar();
 }
Ejemplo n.º 3
0
        public Player(Vector2 setPosition, int setLayer)
        {
            position = setPosition;

            layer   = setLayer;
            damage  = 5;
            texture = Assets.GetTexture(Assets.entity_player);

            maxHealth = 100;
            health    = maxHealth;

            defensePhys = 0; defenseIce = 0; defenseFire = 0; defenseElec = 0;

            guiHUD       = new GuiHud(this);
            guiInventory = new GuiInventory(this);

            Game1.priorityGui = guiHUD;
        }
Ejemplo n.º 4
0
        public void openInventory(GuiInventory inventory)
        {
            inventoryOpened = inventory;

            isInInventory = true;
        }
Ejemplo n.º 5
0
        public void closeInventory()
        {
            inventoryOpened = null;

            isInInventory = false;
        }