Exemple #1
0
    public bool AddItemtoPlayer(string _itemname)
    {
        Item target = LoadItems.CheckItemisvalid(_itemname);

        if (target != null)
        {
            Item_in_hands.AddItem(target);
            return(true);
        }
        return(false);
    }
Exemple #2
0
    public void AddItem()
    {
        switch (item.type)
        {
        case ItemType.Usable:
            if (inventory.AddItem(item, popUpMessage))
            {
                textMessage.SetActive(false);
                Destroy(gameObject);
            }
            break;

        case ItemType.Document:
            if (inventory.AddDocument(item, popUpMessage))
            {
                textMessage.SetActive(false);
                Destroy(gameObject);
            }
            break;

        case ItemType.Memory:
            if (inventory.AddMemory(item, popUpMessage))
            {
                textMessage.SetActive(false);
                Destroy(gameObject);
            }
            break;

        default:
            Debug.Log("Item Type don't exist");
            break;
        }
    }
Exemple #3
0
    public static void loot(GameObject go)
    {
        ItemOnField itm = go.GetComponent <ItemOnField> ();

        if (itm)
        {
            PlayerItems.AddItem(itm.itemName, itm.count);
            MusicProc.doEvent(ActionEvent.Loot, itm.itemName);
            Destroy(go);
            return;
        }
        CheckPoint cp = go.GetComponent <CheckPoint> ();

        if (cp)
        {
            if (cp.finalDoor)
            {
                instance.LevelDone();
            }
            else
            {
                cp.check();
            }
        }
    }
Exemple #4
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Player")
     {
         // give this item to the player
         PlayerItems.AddItem(itemName);
         // play the item pickup sound effect
         GameObject.FindObjectOfType <SoundManager>().PlayBaDing();
         // destory this item
         Destroy(gameObject);
     }
 }
Exemple #5
0
 public override void doAction()
 {
     if (Time.timeSinceLevelLoad - lastTimeCollision > 0.5f)
     {
         lastTimeCollision = Time.timeSinceLevelLoad;
         if (BlobBehaviour.instance.transform.position.y < transform.position.y)
         {
             if (itemCount-- > 0)
             {
                 if (animator != null)
                 {
                     animator.Play();
                 }
                 MusicProc.doEvent(eventName);
                 PlayerItems.AddItem(itemName);
             }
         }
     }
 }
Exemple #6
0
 //ユーザがbombを拾う
 void OnTriggerEnter(Collider other)
 {
     //対象はユーザ
     if (other.gameObject == player)
     {
         //ユーザはbombを持っていない
         if (!playerItems.HaveItem(bombId))
         {
             //拾う音声を流す
             AudioSource.PlayClipAtPoint(itemPickUp, transform.position);
             //bombIdをplayerItemsに渡す
             playerItems.AddItem(bombId);
             //このbombを削除
             Destroy(this.gameObject);
         }
         else
         {
             //ユーザがbombを持っていたら、”これ以上持てません”と画面上に提示する
             bombText.enabled = true;
         }
     }
 }