Ejemplo n.º 1
0
 private void Awake()
 {
     if (m_hidingSpotManager == null)
     {
         m_hidingSpotManager = this;
     }
     else if (m_hidingSpotManager != this)
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 2
0
 private void SeekerActions()
 {
     if (Input.GetKeyDown(KeyCode.Q) && touchingObject != null)
     {
         HidingSpotManager manager = touchingObject.GetComponent <HidingSpotManager>();
         //destroy bug
         if (manager.getBug())
         {
             manager.setBug(false);
             Debug.Log("Destroyed bug");
             touchingObject.gameObject.GetComponent <Renderer>().material.color = Color.blue;
         }
         else
         {
             Debug.Log("No bug found!");
             //Add some stall here
         }
     }
 }
Ejemplo n.º 3
0
 private void HiderActions()
 {
     if (Input.GetKeyDown(KeyCode.E) && touchingObject != null)
     {
         HidingSpotManager manager = touchingObject.GetComponent <HidingSpotManager>();
         //retrieve old bug
         if (manager.getBug())
         {
             Debug.Log("Retrieved bug");
             touchingObject.gameObject.GetComponent <Renderer>().material.color = Color.gray;
             manager.setBug(false);
             bugAmount++;
             //hide new bug1
         }
         else if (bugAmount > 0)
         {
             Debug.Log("Planted bug");
             touchingObject.gameObject.GetComponent <Renderer>().material.color = Color.red;
             manager.setBug(true);
             bugAmount--;
         }
     }
 }