资源简介
Unity3d_动态改变按键设置
Unity3d_动态改变按键设置
Unity3d_动态改变按键设置
代码片段和文件信息
using UnityEngine;
using System.Collections;
public class Controlls : MonoBehaviour {
public custom_inputs inputManager;
public float maxSpeed = 1;
void Start () {
}
void Update ()
{
inputhandling();
}
void inputhandling()
{
// here we put the controlls every ‘isInput[]‘ matches its discriptionstring number
// so if discription 0 is “Up“ then isInput[0] should get the ‘UP‘ code
// inputkey 0 (for example: Up)
//--------------------
if (inputManager.isInput[0])
{
inputManager.analogFeel_up += inputManager.analogFeel_sensitivity;
inputManager.analogFeel_up *= Time.deltaTime;
if (inputManager.analogFeel_up >= maxSpeed) { inputManager.analogFeel_up = maxSpeed; }
transform.position += (Vector3.forward * inputManager.analogFeel_up); //
}
if (!inputManager.isInput[0] && inputManager.analogFeel_up > 0)
{
inputManager.analogFeel_up -= Time.deltaTime * inputManager.analogFeel_up * inputManager.analogFeel_gravity;
if (inputManager.analogFeel_up <= 0) { inputManager.analogFeel_up = 0; }
transform.position += (Vector3.forward * inputManager.analogFeel_up); //
}
// inputkey 1 (for example: Down)
//--------------------
if (inputManager.isInput[1])
{
inputManager.analogFeel_down += inputManager.analogFeel_sensitivity;
inputManager.analogFeel_down *= Time.deltaTime;
if (inputManager.analogFeel_down >= maxSpeed) { inputManager.analogFeel_down = maxSpeed; }
transform.position += (Vector3.back * inputManager.analogFeel_down); //
}
if (!inputManager.isInput[1] && inputManager.analogFeel_down > 0)
{
inputManager.analogFeel_down -= Time.deltaTime * inputManager.analogFeel_down * inputManager.analogFeel_gravity;
if (inputManager.analogFeel_down <= 0) { inputManager.analogFeel_down = 0; }
transform.position += (Vector3.back * inputManager.analogFeel_down); //
}
// inputkey 2 (for example: Left)
//--------------------
if (inputManager.isInput[2])
{
inputManager.analogFeel_left += inputManager.analogFeel_sensitivity;
inputManager.analogFeel_left *= Time.deltaTime;
if (inputManager.analogFeel_left >= maxSpeed) { inputManager.analogFeel_left = maxSpeed; }
transform.position += (Vector3.left * inputManager.analogFeel_left); //
}
if (!inputManager.isInput[2] && inputManager.analogFeel_left > 0)
{
inputManager.analogFeel_left -= Time.deltaTime * inputManager.analogFeel_left * inputManager.analogFeel_gravity;
if (inputManager.analogFeel_left <= 0) { inputManager.analogFeel_left = 0; }
transform.position += (Vecto
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2010-07-23 23:00 Custom input manager 1_4\
目录 0 2010-07-23 23:04 Custom input manager 1_4\Custom input manager 1_4 examples\
目录 0 2010-07-23 22:45 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\
文件 6148 2010-07-11 13:55 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\.DS_Store
目录 0 2010-07-23 22:45 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\
文件 6148 2010-07-11 13:55 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\.DS_Store
目录 0 2010-07-23 22:46 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Art\
文件 72011 2010-07-23 20:42 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Art\inputmanager14.png
目录 0 2010-07-23 22:45 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Art\Materials\
文件 3261 2010-07-07 01:51 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Art\Materials\box 1.mat
文件 3253 2010-07-07 01:51 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Art\Materials\box.mat
目录 0 2010-07-23 22:45 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Gui\
文件 239 2010-07-11 04:40 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Gui\box2.png
文件 245 2007-07-08 20:56 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Gui\horizontalslider.png
文件 103967 2010-07-11 07:18 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Gui\InputManagerGUISkin.GUISkin
文件 496 2007-07-08 20:56 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Gui\toggle on active.png
文件 544 2007-07-08 20:56 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Gui\window.png
目录 0 2010-07-23 22:45 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Prefabs\
文件 8833 2010-07-23 19:31 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Prefabs\InputManagerController.prefab
目录 0 2010-07-23 22:47 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Scenes\
文件 27580 2010-07-23 22:47 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Scenes\example_scene 1.unity
文件 32264 2010-07-23 22:46 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\Scenes\example_scene 2.unity
目录 0 2010-07-23 22:45 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\sc
文件 4418 2010-07-23 19:25 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\sc
文件 3105 2010-07-23 19:25 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\sc
文件 77144 2010-07-23 21:32 Custom input manager 1_4\Custom input manager 1_4 examples\Assets\Our Assets\sc
目录 0 2010-07-23 23:04 Custom input manager 1_4\Custom input manager 1_4 examples\Library\
文件 31201 2010-07-23 23:04 Custom input manager 1_4\Custom input manager 1_4 examples\Library\assetDataba
文件 5238 2010-07-23 22:36 Custom input manager 1_4\Custom input manager 1_4 examples\Library\assetservercachev3
文件 14336 2010-07-03 14:23 Custom input manager 1_4\Custom input manager 1_4 examples\Library\AssetVersioning.db
文件 443 2010-07-23 23:04 Custom input manager 1_4\Custom input manager 1_4 examples\Library\AudioManager.asset
............此处省略208个文件信息
评论
共有 条评论