资源简介
武士2可能4~5年前已经在网络上流传开来,这是一捷克大神出品的神作
新手可能苦于有源码缺好像无从入门(其实这游戏一开始要打包到Android真机测试,但无论是模拟器或者真机,对于Unity高级程序都是很难进行调
试)
这项目就是为了解决这个问题,是一个使武士2源码能支持PC鼠标和键盘操作的扩展源码
这只是扩展非完整项目
代码片段和文件信息
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class PlayerControls
{
public enum E_ButtonStatus
{
UpFirst
Up
DownFirst
Down
Cancel
}
public enum E_ButtonsName
{
None = -1
AttackX
AttackO
Roll
Use
Shop
InGameMenu
ShopOk
ShopCancel
ShopHealth
ShopSword
ShopCombo1
ShopCombo2
ShopCombo3
ShopCombo4
ShopCombo5
ShopCombo6
ShopInfoBuy
ShopInfoBack
Max
}
public class Button
{
public int FingerId = -1;
public E_ButtonStatus Status = E_ButtonStatus.Up;
public bool On = true;
public float PressTime = -1;
bool useRadius;
public Vector2 Center;
float Left Bottom Width Height;
public Button(Vector2 center) {
Center = center; useRadius = true;
}
public Button(float left float bottom float witdth float height) { Left = left; Bottom = bottom; Width = witdth; Height = height; useRadius = false; }
public void SetCenter(Vector2 center) { Center = center; }
//public bool IsInsideButton(Touch touch)
public bool IsInsideButton(Vector2 touchPos)
{
if (useRadius)
{
if ((touchPos - Center).magnitude < 0.07f * Screen.width)
return true;
}
else
{
if (touchPos.x > Left && touchPos.x < Left + Width &&
touchPos.y > Bottom&& touchPos.y < Bottom + Height)
{
return true;
}
}
return false;
}
}
public class JoystickControl
{
public int FingerID = -1;
public float DeadZone { get { return 0.01f * Screen.width; } }
public float Radius {get { return 0.075f * Screen.width;}}
public bool On = true;
public Vector3 Direction = new Vector2();
public float Force;
public Vector2 Center;
public JoystickControl(Vector2 center) { Center = center; }
public void SetCenter(Vector2 center) { Center = center; }
}
Transform _Temp;
public Button[] Buttons;
public JoystickControl Joystick = null;
Transform MainCameraTransfom;
public void Start()
{
Gameobject t = new Gameobject();
_Temp = t.transform;
MainCameraTransfom = Camera.main.transform;
Buttons = new Button[] {
new Button(Game.Instance.ButtonXPositon + new Vector2(GuiButtonX.Instance.ScreenWidth * 0.5f GuiButtonX.Instance.ScreenHeight *0.5f))
new Button(Game.Instance.ButtonOPositon + new Vector2(GuiButtonY.Instance.ScreenWidth * 0.5f GuiBu
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-04-23 02:06 wushi——Pc键盘操作脚本备份\
目录 0 2018-04-23 00:38 wushi——Pc键盘操作脚本备份\Assets\
目录 0 2018-04-23 00:40 wushi——Pc键盘操作脚本备份\Assets\sc
目录 0 2018-04-23 00:38 wushi——Pc键盘操作脚本备份\Assets\sc
目录 0 2018-04-23 00:38 wushi——Pc键盘操作脚本备份\Assets\sc
文件 20016 2018-04-23 02:04 wushi——Pc键盘操作脚本备份\Assets\sc
目录 0 2018-04-23 00:41 wushi——Pc键盘操作脚本备份\Assets\sc
文件 9799 2018-04-18 15:54 wushi——Pc键盘操作脚本备份\Assets\sc
文件 14376 2018-04-18 15:53 wushi——Pc键盘操作脚本备份\Assets\sc
文件 26068 2018-04-18 19:17 wushi——Pc键盘操作脚本备份\Assets\sc
文件 674 2018-04-23 02:14 wushi——Pc键盘操作脚本备份\readme.txt
- 上一篇:JAVA多线程编程详解-详细操作(转自CSDN)
- 下一篇:java实现虚拟键盘
评论
共有 条评论