private void OnItemPlacedInFoyer(GameObject item)
    {
        MemorableItem placedItem = item.GetComponent <ItemController>().itemSettings;

        if (placedItem && placedItem.ID == neededItem.ID)
        {
            hasItemFound = PlayerPrefs.GetInt(PlayerPrefsStrings.itemId + neededItem.ID, 0) == 0 ? false : true;
            OnSwitchItemFound?.Invoke(ID);
        }
    }
Пример #2
0
    public void PopSpeechBubble(MemorableItem item, float time)
    {
        GameObject bubble = Instantiate(speechBubble, bubbleSpawnPos.transform.position, Quaternion.identity);

        bubble.transform.GetChild(0).GetComponent <SpeechBubbleController>().SetBubble(item);
        bubble.transform.GetChild(0).GetComponent <SpeechBubbleController>().destroyTime = time;
        Vector3 temp = bubble.transform.localScale;

        temp.x *= Mathf.Sign(this.transform.localScale.x);
        bubble.transform.localScale = temp;
        bubble.transform.parent     = transform;
        hasSpeechBubble             = true;
    }
Пример #3
0
 private void Awake()
 {
     memorableItemManager = MemorableItemManager.instance;
     foreach (GameObject itemObj in memorableItemManager.memorableItems)
     {
         MemorableItem item     = itemObj.GetComponent <ItemController>().itemSettings;
         bool          hasFound = PlayerPrefs.GetInt(PlayerPrefsStrings.itemId + item.ID, 0) == 1 ? true: false;
         if (hasFound)
         {
             GameObject itemObjIns = Instantiate <GameObject>(item.worldItem, itemPlacement[item.ID].position, Quaternion.identity);
         }
     }
 }
Пример #4
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        MemorableHolder memoHolder = collision.collider.GetComponent <MemorableHolder>();

        if (memoHolder)
        {
            MemorableItem item = memoHolder.memorableItem;
            if (collision.collider.CompareTag("Water"))
            {
                if (!MemorableItemManager.instance.ItemFound(item))
                {
                    playerState            = PlayerState.FallingBack;
                    currentFallingBackTime = fallingBackTime;
                    rb.velocity           *= -0.6f;

                    if (!hasSpeechBubble)
                    {
                        PopSpeechBubble(item, 2);
                    }
                }
            }
            else if (collision.collider.CompareTag("Mountain"))
            {
                if (!MemorableItemManager.instance.ItemFound(item))
                {
                    if (!hasSpeechBubble)
                    {
                        PopSpeechBubble(item, 2);
                    }
                }
            }
            else if (collision.collider.CompareTag("High grass"))
            {
                if (!MemorableItemManager.instance.ItemFound(item))
                {
                    if (!hasSpeechBubble)
                    {
                        PopSpeechBubble(item, 2);
                    }
                }
            }
        }
    }
 public void SetBubble(MemorableItem item)
 {
     transform.GetChild(0).GetComponent <SpriteRenderer>().sprite = item.worldItem.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite;
     StartCoroutine(DestroyBubble());
 }
Пример #6
0
    public bool ItemFound(MemorableItem item)
    {
        bool hasitem = PlayerPrefs.GetInt(PlayerPrefsStrings.itemId + item.ID) == 0 ? false : true;

        return(hasitem);
    }