• 大小: 75.82MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2022-01-31
  • 语言: 其他
  • 标签: go  pokemon  

资源简介

用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.meta

    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.meta

    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.meta

    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.meta

    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.meta

    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.meta

    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.meta

    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.meta

    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.meta

    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.meta

    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.meta

    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.meta

    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.meta

    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.meta

    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.meta

............此处省略2971个文件信息

评论

共有 条评论