예제 #1
0
 private void UseItem(Base.Item item)
 {
     switch (item.Type)
     {
     case Items.PotionBlue:
         // TODO: Flash character red when the potion is used instead of drawing out the heart fill
         Inventory.RemoveItem(new Base.Item {
             Type = item.Type, Amount = 1
         });
         break;
     }
 }
예제 #2
0
파일: Item.cs 프로젝트: incutonez/ZeldaU
        public static Item Spawn(Vector3 position, Base.Item config, Transform parent)
        {
            RectTransform transform = Instantiate(Manager.Game.Graphics.Item);

            transform.SetParent(parent);
            // TODO: There's some sort of pivoting issue with items, so we need to adjust them by doing this
            // I'm not sure why this isn't an issue with the Tiles... it might have to do with the fact that we
            // set a CenterPosition on them... I forget why I had to do that
            transform.localPosition = position;
            transform.rotation      = Quaternion.identity;

            Item itemWorld = transform.GetComponent <Item>();

            itemWorld.SetItem(config);

            return(itemWorld);
        }
예제 #3
0
파일: Item.cs 프로젝트: incutonez/ZeldaU
        public void SetItem(Base.Item item)
        {
            BaseItem = item;
            Sprite sprite = item.GetSprite();

            if (sprite != null)
            {
                Renderer.sprite = sprite;
                if (sprite != null)
                {
                    Transform.name = sprite.name;
                }
                // If we have a Heart or Triforce, we need to make it blink, so let's add the blink component
                if (item.Type == Items.Heart || item.Type == Items.TriforceShard)
                {
                    Animation.Blink blinkAnimation = gameObject.AddComponent <Animation.Blink>();
                    blinkAnimation.Initialize(Manager.Game.Graphics.GetAnimations(item.Type));
                }
            }
        }
예제 #4
0
 public void SetSword(Base.Item item)
 {
     SwordType = item.Type;
     Damage    = SwordType.GetAttribute <DamageAttribute>();
 }