Euras

PlayerActions

Jan 31st, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class PlayerActions : MonoBehaviour {
  5.  
  6.     // Player Variables
  7.     PlayerMonsterInventory monsterInventory;
  8.     PlayerCatchMonster monsterCatch;
  9.     PlayerReleaseMonster monsterRelease;
  10.     PlayerRaycast raycastMonster;
  11.  
  12.     // Menu Variables
  13.     public GameObject menu;
  14.  
  15.     void Start()
  16.     {
  17.         monsterInventory = GetComponent<PlayerMonsterInventory>();
  18.         monsterCatch = GetComponent<PlayerCatchMonster>();
  19.         monsterRelease = GetComponent<PlayerReleaseMonster>();
  20.         raycastMonster = GetComponentInChildren<PlayerRaycast>();
  21.     }
  22.  
  23.     void Update ()
  24.     {
  25.         if(Input.GetMouseButtonDown(0))
  26.         {
  27.             if(raycastMonster.RaycastToMonster())
  28.             {
  29.                 monsterCatch.CatchMonster(raycastMonster.hit.transform.gameObject);
  30.             }
  31.         }
  32.  
  33.         if(Input.GetKeyDown(KeyCode.Escape))
  34.         {
  35.             menu.GetComponent<InitializeMenu>().ToggleMenu();
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment