资源简介
用unity+高德地理定位做的,模仿pokemon go的尝试的demo。
源码太大,所以分成两部分。
详细内容看http://blog.csdn.net/wuyt2008/article/details/52934083
代码片段和文件信息
using UnityEngine;
using System.Collections;
namespace TAK_CameraController
{
enum MouseButtonDown
{
MBD_LEFT = 0
MBD_RIGHT
MBD_MIDDLE
};
public class CameraController : MonoBehaviour
{
[SerializeField]
private Vector3 focus = Vector3.up;
[SerializeField]
private Gameobject focusObj = null;
private Vector3 oldPos;
void setupFocusobject(string name)
{
Gameobject obj = this.focusObj = new Gameobject(name);
obj.transform.position = this.focus;
obj.transform.LookAt(this.transform.position);
return;
}
void Start ()
{
if (this.focusObj == null)
this.setupFocusobject(“CameraFocusobject“);
Transform trans = this.transform;
transform.parent = this.focusObj.transform;
trans.LookAt(this.focus + new Vector3(0 1 1));
return;
}
void Update ()
{
this.mouseEvent();
return;
}
void mouseEvent()
{
float delta = Input.GetAxis(“Mouse ScrollWheel“);
if (delta != 0.0f)
this.mouseWheelEvent(delta);
if (Input.GetMouseButtonDown((int)MouseButtonDown.MBD_LEFT) ||
Input.GetMouseButtonDown((int)MouseButtonDown.MBD_MIDDLE) ||
Input.GetMouseButtonDown((int)MouseButtonDown.MBD_RIGHT))
this.oldPos = Input.mousePosition;
this.mouseDragEvent(Input.mousePosition);
return;
}
void mouseDragEvent(Vector3 mousePos)
{
Vector3 diff = mousePos - oldPos;
if (Input.GetMouseButton((int)MouseButtonDown.MBD_LEFT))
{
if (diff.magnitude > Vector3.kEpsilon)
this.cameraTranslate(-diff / 100.0f);
}else if (Input.GetMouseButton((int)MouseButtonDown.MBD_MIDDLE))
{
if (diff.magnitude > Vector3.kEpsilon)
this.cameraRotate(new Vector3(diff.y diff.x 0.0f));
}else if (Input.GetMouseButton((int)MouseButtonDown.MBD_RIGHT))
{
}
this.oldPos = mousePos;
return;
}
public void mouseWheelEvent(float delta)
{
Vector3 focusToPosition = this.transform.position - this.focus;
Vector3 post = focusToPosition * (1.0f + delta);
if (post.magnitude > 0.01)
this.transform.position = this.focus + post;
return;
}
void cameraTranslate(Vector3 vec)
{
Transform focusTrans = this.focusObj.transform;
vec.x *= -1;
focusTrans.Translate(Vector3.right * vec.x);
focusTrans.Translate(Vector3.up * vec.y);
this.focus = focusTrans.position;
return;
}
public void cameraRotate(Vector3 eulerAngle)
{
Transform focusTrans = this.focusObj.transform;
focusTrans.localEulerAngles = focusTrans.localEulerAngles + eulerAngle;
this.transform.LookAt(this.focus+ new Vector3(0 1 0));
return;
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
I.A.... 815840 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\FUCM03_0019_HeadSpring.fbx
I.A.... 41347 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\FUCM03_0019_HeadSpring.fbx.me
I.A.... 832896 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\FUCM05_0000_Idle.fbx
I.A.... 41303 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\FUCM05_0000_Idle.fbx.me
I.A.... 749312 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\FUCM05_0001_M_CMN_LJAB.fbx
I.A.... 41301 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\FUCM05_0001_M_CMN_LJAB.fbx.me
I.A.... 863360 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\FUCM05_0022_M_RISING_P.fbx
I.A.... 41311 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\FUCM05_0022_M_RISING_P.fbx.me
I.A.... 761616 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\FUCM_0012b_EH_RUN_LP_NoZ.fbx
I.A.... 43376 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\FUCM_0012b_EH_RUN_LP_NoZ.fbx.me
I.A.... 796832 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\FUCM_04_0001_RHiKick.fbx
I.A.... 41339 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\FUCM_04_0001_RHiKick.fbx.me
I.A.... 815840 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\FUCM_04_0010_MC2_SAMK.fbx
I.A.... 41335 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\FUCM_04_0010_MC2_SAMK.fbx.me
I.A.... 3231 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body.mat
I.A.... 181 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body.mat.me
I.A.... 3232 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body1.mat
I.A.... 181 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body1.mat.me
I.A.... 3232 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body2.mat
I.A.... 181 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body2.mat.me
I.A.... 3232 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body3.mat
I.A.... 181 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body3.mat.me
I.A.... 3232 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body4.mat
I.A.... 181 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body4.mat.me
I.A.... 3232 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body5.mat
I.A.... 181 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body5.mat.me
I.A.... 3232 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body6.mat
I.A.... 181 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body6.mat.me
I.A.... 3232 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body7.mat
I.A.... 181 2016-10-26 13:30 pokemon\Assets\FightingUnityChan_FreeAsset\FightingUnityChan_FreeAsset\Animations\Materials\body7.mat.me
............此处省略2971个文件信息
相关资源
- SPSS 25 演算法SPSS_Statistics_AlgorithmsIBM官
- LINGO线性规划及其灵敏度分析.doc
- Goose报文发送模拟工具
- Octotree 2.4.6 谷歌浏览器GitHub插件 最新
- 飞歌开机logo修改工具安装文件logoto
- golang image图片处理
- UTAGOE汉化版人声提取工具超好用
- LINGO简易教程优化问题求解,灵敏度分
- 谷歌云PC客户端
- scrapy ---爬取豌豆荚并分析数据
- lingo-2017破解版
- LogoTool(1.0.3.2)
- PathfinderLogoTools
- facebook、google和naver第三方登录
- Go-ewma-Go实现指数加权移动平均算法
- 设置和取消开机自动启动
- 各种 放在PCB上的 logo 图标 封装库3
- Google地图经纬度与平面坐标的相互转
- 飞歌导航开机LOGO修改工具 LOGOTOOLS
- 仿百度/google搜索引擎
- 遗传算法goat工具箱
- Computer Vision: Algorithms and Applications R
- GourmetCoffeeSystem.zip
- mvc使用mongodb
- Gojs设备线路高亮Demo
- pc-logo语言教学软件
- 关于潘安湖风景区的游览路线设计
- 基于LINGO的多目标规划模型求解
- PCB Logo Creator
- Go-tcpserver-一个Go库用于快速构建Tcp服
评论
共有 条评论