1
0
Fork 0
This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
Global-Game-Jam-2019/Assets/Scripts/Manette.cs
2019-01-27 14:54:55 +01:00

76 lines
1.6 KiB
C#

using System;
using UnityEngine;
public class Manette
{
public static bool IsUp ()
{
if (Input.GetJoystickNames().Length > 0)
{
float value = Input.GetAxis("Vertical");
if (value > 0.01) return true;
else return false;
}
return false;
}
public static bool IsDown()
{
if (Input.GetJoystickNames().Length > 0)
{
float value = Input.GetAxis("Vertical");
if (value < -0.01) return true;
else return false;
}
return false;
}
public static bool IsRight()
{
if (Input.GetJoystickNames().Length > 0)
{
float value = Input.GetAxis("Horizontal");
if (value > 0.01) return true;
else return false;
}
return false;
}
public static bool IsLeft()
{
if (Input.GetJoystickNames().Length > 0)
{
float value = Input.GetAxis("Horizontal");
if (value < -0.01) return true;
else return false;
}
return false;
}
public static bool IsUse()
{
if (Input.GetJoystickNames().Length > 0)
{
return Input.GetButtonDown("Fire1");
}
return false;
}
public static bool IsTorch()
{
if (Input.GetJoystickNames().Length > 0)
{
return Input.GetButtonDown("Fire2");
}
return false;
}
public static bool IsPlaceBlock()
{
if (Input.GetJoystickNames().Length > 0)
{
return Input.GetButtonDown("Space");
}
return false;
}
}