示例#1
0
 /// <summary>
 /// When player is within collider, check if key is pressed and open dialogue if so
 /// </summary>
 /// <param name="other">The object that has been collided with, checked to see if "Player"</param>
 void OnTriggerStay2D(Collider2D other)
 {
     if (other.gameObject.name == "Player" && keyPressed() && !dManager.dialogueActive)
     {
         //Test debug
         if (dManager == null)
         {
             dManager = FindObjectOfType <DialogueScript> ();
         }
         SoundManager.instance.playSFX("interact");
         dManager.showDialogue(dialogue, this);
         movementScript.setCanMove(false);
     }
 }
示例#2
0
 /// <summary>
 /// When collides with the player and <see cref="inRange"/> is <c>false</c> , trigger functionality.
 /// This involves setting <see cref="inRange"/> to <c>true</c>,
 /// playing sound effect, displaying text and calling <see cref="healPlayers"/>
 /// </summary>
 /// <param name="other">The object this has collided with, triggering functionality when it's the player</param>
 void OnTriggerStay2D(Collider2D other)
 {
     if (other.gameObject.name == "Player" && !inRange && !dManager.dialogueActive)
     {
         inRange = true;
         SoundManager.instance.playSFX("interact");
         if (dManager == null)
         {
             dManager = FindObjectOfType <DialogueScript> ();
         }
         dManager.showDialogue(text);
         movementScript.setCanMove(false);
         healPlayers();
     }
 }
示例#3
0
 /// <summary>
 /// When collides with the player and <see cref="inRange"/> is <c>false</c> , trigger functionality.
 /// This involves setting <see cref="inRange"/> to <c>true</c>,
 /// playing sound effect, displaying text and calling <see cref="healPlayers"/>
 /// [EXTENSION] - Log that healing station has been used, don't activate when menu open
 /// </summary>
 /// <param name="other">The object this has collided with, triggering functionality when it's the player</param>
 void OnTriggerStay2D(Collider2D other)
 {
     //if collided with player, player wasn't already on space, no dialogue screen is active and the menu isn't open
     if (other.gameObject.name == "Player" && !inRange && !dManager.dialogueActive && !SceneChanger.instance.menuOpen)
     {
         inRange = true;             //set inRange to true so won't be triggered again without first stepping off space
         SoundManager.instance.playSFX("interact");
         if (dManager == null)
         {
             dManager = FindObjectOfType <DialogueScript> ();                //locate dialoguescript if needed
         }
         dManager.showDialogue(text);                                        //display text
         movementScript.setCanMove(false);                                   //stop player moving when text is shown
         healPlayers();                                                      //heal the players
         QManagerObj.manager.logQuestVariable(questTypes.noHealingStations); //log healing station has been used
     }
 }
示例#4
0
 /// <summary>
 /// When player is within collider, check if key is pressed and open dialogue if so
 /// starts dialogue
 /// starts vendor as appropriate
 /// </summary>
 /// <param name="other">The object that has been collided with, checked to see if "Player"</param>
 void OnTriggerStay2D(Collider2D other)
 {
     if (other.gameObject.name == "Player" && keyPressed() && !dManager.dialogueActive && !SceneChanger.instance.menuOpen)
     {
         //Test debug
         if (dManager == null)
         {
             dManager = FindObjectOfType <DialogueScript> ();
         }
         SoundManager.instance.playSFX("interact");
         dManager.showDialogue(dialogue, this);
         movementScript.setCanMove(false);
         if (vendor)
         {
             gameObject.GetComponent <Vendor>().setDraw(true);
         }
     }
 }