This commit is contained in:
lapich committed 2026-03-22 01:50:14 +03:00
1 parent 6e3d5ab9a2
commit c9085558cd
552 files changed
+133467 -220

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class GunsMenu : MonoBehaviour
{
public GameObject Buttons;
public GameObject[] Guns;
int currentGun = 0;
void Start()
{
Guns[0].SetActive(true);
}
public void NextGun()
{
Guns[currentGun ].SetActive(false);
currentGun++;
if (currentGun >= Guns.Length)
currentGun = 0;
Guns[currentGun].SetActive(true);
}
public void PreviousGun()
{
Guns[currentGun].SetActive(false);
currentGun--;
if (currentGun < 0)
currentGun = Guns.Length - 1;
Guns[currentGun].SetActive(true);
}
private void Update()
{
if ((Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) || (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began && !EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId)))
{
Buttons.SetActive(false);
}
else if(Input.touchCount == 0 && !Input.GetMouseButton(0))
{
Buttons.SetActive(true);
}
}
}