Advertisement
Guest User

Main_Menu_02.cs

a guest
Feb 5th, 2016
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Main_Menu_02 : MonoBehaviour
  5. {
  6.     public GameObject InstructionContainer;
  7.     public GameObject Buttons;
  8.     public GameObject AW;
  9.     public GameObject Instruction;
  10.     public GameObject Exit;
  11.     public Texture Active;
  12.     public Texture nonActive;
  13.  
  14.  
  15.  
  16.     public AudioClip SFX_select;
  17.  
  18.     // Update is called once per frame
  19.     void Update ()
  20.     {
  21.         if (Input.touches.Length <=0)
  22.         {
  23.             this.guiTexture.texture = nonActive;
  24.         }
  25.         else
  26.         {
  27.             if(Input.touches.Length == 1)
  28.             {
  29.                 if(this.guiTexture.HitTest(Input.GetTouch(0).position))
  30.                 {
  31.                     if(Input.GetTouch(0).phase == TouchPhase.Began)
  32.                     {
  33.                         audio.PlayOneShot(SFX_select);
  34.                         this.guiTexture.texture = Active;
  35.                     }
  36.                     if(Input.GetTouch(0).phase == TouchPhase.Ended)
  37.                     {
  38.                         if(this.gameObject == AW)
  39.                             Application.LoadLevel("LoadingAW");
  40.                         else if(this.gameObject == Instruction)
  41.                         {
  42.                             InstructionContainer.SetActive(true);
  43.                             Buttons.SetActive(false);
  44.                         }
  45.                         else if (this.gameObject == Exit)
  46.                         {
  47.                             Application.Quit();
  48.                         }
  49.                     }
  50.                 }
  51.             }
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement