Beispiel #1
0
 void CarryOutPickupActions(Transform tParent)
 {
     if (!CheckIfLocked())
     {
         transform.SetParent(tParent);
         itemMaster.CallEventObjectPickup();
         transform.gameObject.SetActive(false);
         GameManager_Audio.PlaySFX(pickupSFX);
         Debug.Log("picking up item");
     }
 }
Beispiel #2
0
 public void PickBubble()
 {
     //		SetVisibility (true);
     if (!CheckIfLocked())
     {
         Debug.Log("picking: " + gameObject);
         GameManager_Audio.PlaySFX("sfx_owl");
         //If this cube is picked, set players location to this cube.
         Player p = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
         p.SetPosition(levelBubble.transform.position);                 //put the player at this cube
         levelBubble.SetActive(true);
         this.transform.parent.gameObject.SetActive(false);
     }
 }
Beispiel #3
0
        public bool Unlock()
        {
            //TODO check if hastherightkey
            if (CheckIfPlayerHasKey())
            {
                //isLocked = false;
                gameObject.SetActive(false);
                GameManager_Audio.PlaySFX("sfx_unlock");
                return(true);

                Debug.Log("Unlocked: " + this.name);
            }
            return(false);
        }
Beispiel #4
0
        bool CheckIfPlayerHasKey()
        {
            Debug.Log("checkifplayerhaskey");
            //player.GetComponent<Player_Master>().GetHasKey();
            Transform inventoryPlayerParent = GameManager_References._player.GetComponent <Player_Inventory>().inventoryPlayerParent;

            foreach (Transform child in inventoryPlayerParent)
            {
                Debug.Log("child in inventoryPlayerParent: " + child);
                if (child.name == keyName)
                {
                    return(true);
                }
            }
            GameManager_Audio.PlaySFX("sfx_lock");
            return(false);
        }