Beispiel #1
0
 private void OnMouseOver()
 {
     if (Vector3.Distance(transform.position, player.transform.position) < 5)
     {
         if (playerItemScript.GetHasItem() == false || itemAccepted)
         {
             displayTextScript.SetEnabled(false);
         }
         else
         {
             displayTextScript.SetEnabled(true);
             playerItemScript.AllowDroppingItems(false);
             if (playerItemScript.GetHeldObject().name == itemToAccept.name && Input.GetKeyDown(KeyCode.E))
             {
                 playerItemScript.DisableItemOnPedestal();
                 playerItemScript.GetItemPlace(itemPlace);
                 playerItemScript.TriggerAnimPlace();
                 itemAccepted = true;
                 m_MyAudioSource.Play();
                 if (doorManagerScript != null)
                 {
                     doorManagerScript.CheckWinCondition();
                 }
                 else if (gateManagerScript != null)
                 {
                     gateManagerScript.OpenGate();
                 }
                 else
                 {
                     Debug.Log(gameObject.name + " is missing door reference");
                 }
             }
         }
     }
 }