资源简介
unity3d跑酷游戏DEMO源码,可以用来入门学习。
有障碍物,可以跳跃。
代码片段和文件信息
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class GameManager : MonoBehaviour {
// 生成障碍物点列表
public List bornPosList = new List();
// 道路列表
public List roadList = new List();
// 抵达点列表
public List arrivePosList = new List();
// 障碍物列表
public Listject> objPrefabList = new Listject>();
// 目前的障碍物
Dictionaryject>> objDict = new Dictionaryject>>();
public int roadDistance;
public bool isEnd = false;
// Use this for initialization
void Start () {
foreach(Transform road in roadList)
{
Listject> objList = new Listject>();
objDict.Add(road.name objList);
}
initRoad(0);
initRoad(1);
}
// Update is called once per frame
void Update () {
}
// 切出新的道路
public void changeRoad(Transform arrivePos)
{
int index = arrivePosList.IndexOf(arrivePos);
if(index >= 0)
{
int lastIndex = index - 1;
if (lastIndex < 0)
lastIndex = roadList.Count - 1;
// 移动道路
roadList[index].position = roadList[lastIndex].position + new Vector3(roadDistance 0 0);
initRoad(index);
}
else
{
Debug.LogError(“arrivePos index is error“);
return;
}
}
void initRoad(int index)
{
string roadName = roadList[index].name;
// 清空已有障碍物
foreach(Gameobject obj in objDict[roadName])
{
Destroy(obj);
}
objDict[roadName].Clear();
// 添加障碍物
foreach(Transform pos in bornPosList[index])
{
Gameobject prefab = objPrefabList[Random.Range(0 objPrefabList.Count)];
Vector3 eulerAngle = new Vector3(0 Random.Range(0 360) 0);
Gameobject obj = Instantiate(prefab pos.position Quaternion.EulerAngles(eulerAngle)) as Gameobject;
obj.tag = “Obstacle“;
objDict[roadName].Add(obj);
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-04-08 03:18 RunningDemo\
目录 0 2016-02-22 00:08 RunningDemo\.vs\
目录 0 2016-02-22 00:08 RunningDemo\.vs\RunningDemo\
目录 0 2016-02-22 01:04 RunningDemo\.vs\RunningDemo\v14\
文件 44544 2016-04-08 02:50 RunningDemo\.vs\RunningDemo\v14\.suo
目录 0 2016-04-07 23:39 RunningDemo\Assets\
目录 0 2016-04-07 23:54 RunningDemo\Assets\Models\
文件 192 2016-04-07 23:39 RunningDemo\Assets\Models.me
文件 8856 2016-04-07 23:54 RunningDemo\Assets\Models\character.controller
文件 180 2016-04-07 23:42 RunningDemo\Assets\Models\character.controller.me
文件 896480 2013-06-20 04:08 RunningDemo\Assets\Models\character.fbx
文件 12850 2016-04-07 23:39 RunningDemo\Assets\Models\character.fbx.me
目录 0 2016-04-07 23:39 RunningDemo\Assets\Models\Materials\
文件 192 2016-04-07 23:39 RunningDemo\Assets\Models\Materials.me
文件 4260 2013-06-20 04:08 RunningDemo\Assets\Models\Materials\character_mat.mat
文件 138 2016-04-07 23:39 RunningDemo\Assets\Models\Materials\character_mat.mat.me
目录 0 2016-04-07 23:39 RunningDemo\Assets\Models\Textures\
文件 192 2016-04-07 23:39 RunningDemo\Assets\Models\Textures.me
文件 3145772 2013-06-20 04:08 RunningDemo\Assets\Models\Textures\character_color.tga
文件 1166 2016-04-07 23:39 RunningDemo\Assets\Models\Textures\character_color.tga.me
文件 3145772 2013-06-20 04:08 RunningDemo\Assets\Models\Textures\character_normal.tga
文件 1165 2016-04-07 23:39 RunningDemo\Assets\Models\Textures\character_normal.tga.me
目录 0 2016-04-08 02:49 RunningDemo\Assets\Scenes\
文件 192 2016-02-21 22:30 RunningDemo\Assets\Scenes.me
文件 99824 2016-04-08 02:49 RunningDemo\Assets\Scenes\gameScene.unity
文件 175 2016-02-21 22:38 RunningDemo\Assets\Scenes\gameScene.unity.me
目录 0 2016-04-08 02:48 RunningDemo\Assets\sc
文件 192 2016-02-22 00:03 RunningDemo\Assets\sc
文件 2327 2016-04-08 02:24 RunningDemo\Assets\sc
文件 263 2016-04-08 01:29 RunningDemo\Assets\sc
文件 4551 2016-04-08 02:48 RunningDemo\Assets\sc
............此处省略1451个文件信息
- 上一篇:基于ROS的移动机器人SLAM研究
- 下一篇:半导体激光器
相关资源
- unity3d做的3dmax人物模型有走,跑等动
- unity3d 飘带插件 Dynamic Bone 1.1.8
- unity3D赛车游戏完整
- Unity3d下使用图灵机器人
- Unity网络多玩家游戏开发实用教程
- Unity3D视频转换器TheoraConverter.NET+1.1+
- Unity3D的国际象棋源码Chess Game.unitypa
- unity3dFPS狙击游戏源码
- Unity3D插件 Paint in 3D可用于船体涂装仿
- unity3D网络五子棋
- Unity3D海面效果不错的学习资料
- Unity3D Glow Effect 自发光 颜色溢出效果
- Unity3d雨水特效资源包
- Unity3D画笔 涂鸦 签字
- Unity3D掷筛子游戏源码
- Unity3d_动态改变按键设置
- Unity3d_项目_足球Game
- Unity 最新T4M地形插件,适用于5.6以上
- Unity3D小DEMO源码
- unity3d基础讲解 ppt
- unity3D demo
- Unity3D从入门到精通高清PDF共231页全
- unity3d 赛车DEMO
- unity3d鱼类游动AI demo
- Unity3D UGUI官方案例
- Unity3D超炫的水效果
- unity网络五子棋源代码
- Unity3D平衡类游戏--平衡小球Demo解析(
- unity3d 太阳 地球 月球 构成的建议太阳
- [新出炉]Unity 2017 游戏优化 英文原版
评论
共有 条评论