R1
This commit is contained in:
parent
37252a4edc
commit
19ab6f65e3
258 changed files with 406592 additions and 0 deletions
76
Assets/Scripts/Manette.cs
Normal file
76
Assets/Scripts/Manette.cs
Normal file
|
@ -0,0 +1,76 @@
|
|||
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;
|
||||
}
|
||||
}
|
Reference in a new issue