mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 09:54:28 -05:00
Added Additional logic to controls menu
-players can no longer leave with same keys and if they do they will be set to default -Added some additional changes to animator
This commit is contained in:
39
Assets/Scripts/UI/Controls/ControlsMenuScript.cs
Normal file
39
Assets/Scripts/UI/Controls/ControlsMenuScript.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ControlsMenuScript : MonoBehaviour
|
||||
{
|
||||
public GameObject keyboardControlsMenu;
|
||||
public GameObject gamePadControlsMenu;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//if vertical input from right analog
|
||||
if (Input.GetAxis("KingVerticalMouseMove") != 0 || Input.GetAxis("KingHorizontalMouseMove") != 0)
|
||||
{
|
||||
//if off, turn it on
|
||||
if(gamePadControlsMenu.activeInHierarchy == false)
|
||||
{
|
||||
keyboardControlsMenu.SetActive(false);
|
||||
gamePadControlsMenu.SetActive(true);
|
||||
}
|
||||
}
|
||||
//check if mouse movement if so (turn off pointer)
|
||||
if (Input.GetAxis("Mouse X") != 0 || Input.GetAxis("Mouse Y") != 0)
|
||||
{
|
||||
if (keyboardControlsMenu.activeInHierarchy == false)
|
||||
{
|
||||
keyboardControlsMenu.SetActive(true);
|
||||
gamePadControlsMenu.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user