Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        if (Input.GetMouseButtonDown(0))
        {
            if (Collider == Physics2D.OverlapPoint(mousePos))
            {
                ButtonClicked = true;
                //GetComponent<SpriteRenderer>().color = new Color(100, 100, 100, 255);
                GetComponent <SpriteRenderer>().color = new Color(0, 100, 0, 255);
                Vector3 buttonPos = transform.position;
                buttonPos         += new Vector3(0.1f, -0.1f);
                transform.position = buttonPos;
            }
        }

        if (Input.GetMouseButtonUp(0) & ButtonClicked)
        {
            if (Collider == Physics2D.OverlapPoint(mousePos))
            {
                ButtonClicked = true;
                GameInfo.ResetValues();
                SceneManager.LoadScene(LoadGameManager.GetAvailableGame());
            }
            else
            {
                ButtonClicked = false;
                GetComponent <SpriteRenderer>().color = new Color(255, 255, 255, 255);
                Vector3 buttonPos = transform.position;
                buttonPos         -= new Vector3(0.1f, -0.1f);
                transform.position = buttonPos;
            }
        }
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        loadGameManager = GameObject.Find("LoadGame_Manager").GetComponent<LoadGameManager>();

        if (name == "LoadGame_Button" && !loadGameManager.HasLeveToLoad())
        {
            DisableButton();
        }
    }
Exemplo n.º 3
0
 protected void PlayerFailure()
 {
     GameInfo.PlayerLives--;
     if (PlayerLives == 0)
     {
         SceneManager.LoadScene("MainMenu");
     }
     else
     {
         SceneManager.LoadScene(LoadGameManager.GetAvailableGame());
     }
 }
 private void Awake()
 {
     if (Instance != null && Instance != this)
     {
         // destroy the duplicate
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
     }
 }
Exemplo n.º 5
0
 protected void PlayerSuccess()
 {
     GameInfo.IncScore();
     SceneManager.LoadScene(LoadGameManager.GetAvailableGame());
 }