Compare commits

..

No commits in common. 'master' and 'xf' have entirely different histories.
master ... xf

@ -1,101 +0,0 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class GameManager : MonoBehaviour {
// 生成障碍物点列表
public List<Transform> bornPosList_Obstacle = new List<Transform>();
//生成道具点列表
public List<Transform> bornPosList_Tool = new List<Transform>();
// 道路列表
public List<Transform> roadList = new List<Transform>();
// 抵达点列表
public List<Transform> arrivePosList = new List<Transform>();
// 障碍物列表
public List<GameObject> objObstacleList = new List<GameObject>();
//道具列表
public List<GameObject> objToolList = new List<GameObject>();
// 目前的障碍物
Dictionary<string, List<GameObject>> objDict = new Dictionary<string, List<GameObject>>();
//目前的道具
Dictionary<string, List<GameObject>> objDict1 = new Dictionary<string, List<GameObject>>();
public int roadDistance;
public bool isEnd = false;
// Use this for initialization
[System.Obsolete]
void Start () {
foreach(Transform road in roadList)
{
List<GameObject> objList = new List<GameObject>();
objDict.Add(road.name, objList);
}
initRoad(0);
initRoad(1);
}
// Update is called once per frame
void Update () {
}
// 切出新的道路
[System.Obsolete]
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;
}
}
[System.Obsolete]
void initRoad(int index)
{
string roadName = roadList[index].name;
// 清空已有障碍物
foreach(GameObject obj in objDict[roadName])
{
Destroy(obj);
}
//清空已有道具
/*foreach (GameObject obj in objDict1[roadName])
{
Destroy(obj);
}*/
objDict[roadName].Clear();
//objDict1[roadName].Clear();
// 添加障碍物
foreach (Transform pos in bornPosList_Obstacle[index])
{
GameObject prefab = objObstacleList[Random.Range(0, objObstacleList.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);
}
//添加道具
foreach (Transform pos in bornPosList_Tool[index])
{
GameObject prefab = objToolList[Random.Range(0, objToolList.Count)];
Vector3 eulerAngle = new Vector3(0, Random.Range(0, 360), 0);
GameObject obj = Instantiate(prefab, pos.position, Quaternion.EulerAngles(eulerAngle)) as GameObject;
obj.tag = "Tool";
objDict[roadName].Add(obj);
}
}
}

@ -1,103 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using I2.Loc;
//using UnityEngine.SceneManagement;
public class GameMenu : MonoBehaviour
{
[SerializeField]
public Transform UIPanel;
public Transform HelpingPanel;// Start is called before the first frame update
public Transform SettingPanel;
public Transform GroundPanel;
public Transform AboutPanel;
public MusicPlayer musicPlayer;
public Transform Buttonsvoice;
public string language="Eglish";
public SetLanguage setLanguage;
bool clickSetting=false;
void Start()
{
HelpingPanel.gameObject.SetActiveRecursively(false);
SettingPanel.gameObject.SetActiveRecursively(false);
Buttonsvoice.gameObject.SetActiveRecursively(false);
GroundPanel.gameObject.SetActiveRecursively(false);
AboutPanel.gameObject.SetActiveRecursively(false);
}
// Update is called once per frame
void Update()
{
}
public void Bunttonvoice()
{
Buttonsvoice.gameObject.SetActiveRecursively(true);
}
public void StartGame()
{
// Buttonsvoice.gameObject.SetActiveRecursively(false);
Application.LoadLevel(1);//跳转到游戏场景
//SceneManager.LoadScene(1);
}
public void Settings()
{
SettingPanel.gameObject.SetActiveRecursively(true);//跳转到设置界面
clickSetting = true;
Buttonsvoice.gameObject.SetActiveRecursively(false);
}
public void Help()
{
HelpingPanel.gameObject.SetActiveRecursively(true);
//Application.LoadLevel(0);
Buttonsvoice.gameObject.SetActiveRecursively(false);
}
public void Back()
{
Buttonsvoice.gameObject.SetActiveRecursively(false);
SettingPanel.gameObject.SetActiveRecursively(false);
HelpingPanel.gameObject.SetActiveRecursively(false);
AboutPanel.gameObject.SetActiveRecursively(false);
musicPlayer.needShow = false;
}
public void HelpBack()
{
GroundPanel.gameObject.SetActiveRecursively(false);
AboutPanel.gameObject.SetActiveRecursively(false);
HelpingPanel.gameObject.SetActiveRecursively(true);
}
public void Quit()
{
// Buttonsvoice.gameObject.SetActiveRecursively(false);
UnityEditor.EditorApplication.isPlaying = false;
Application.Quit();
}
public void GameBackgroud()
{
GroundPanel.gameObject.SetActiveRecursively(true);
Buttonsvoice.gameObject.SetActiveRecursively(false);
}
public void AboutGame()
{
AboutPanel.gameObject.SetActiveRecursively(true);
Buttonsvoice.gameObject.SetActiveRecursively(false);
}
/* public void changeLanguage()
{
if (language == "Chinese") language = "English";
else language = "Chinese";
}*/
public void SetLanguage(string language)
{
setLanguage._Language=language;
setLanguage.ApplyLanguage();
}
}

@ -1,54 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;//使用 该引用,才能获得 Text 组件。
public class Language : MonoBehaviour
{
//public bool change = false;
public string state = "en";
float m_timer = 0;
Button btn;
public List<Text> texts = new List<Text>();
private void Start()
{
/* texts[0] = GameObject.Find("StartButton").GetComponent<Text>();
texts[1] = GameObject.Find("SettingButton").GetComponent<Text>();
texts[2] = GameObject.Find("HelpButton").GetComponent<Text>();
texts[3] = GameObject.Find("QuitButton").GetComponent<Text>();*/
}
private void Update()
{
if (state == "ch")
{
texts[0].text = "开始游戏";
texts[1].text = "设置";
texts[2].text = "帮助";
texts[3].text = "退出";
}
else if (state == "en")
{
texts[0].text= "StartGame";
texts[1].text= "Setting";
texts[2].text = "Help";
texts[3].text = "Quit";
}
}
public void changeLanguage()
{
if (state == "en") state = "ch";
else state = "en";
Debug.Log("你改变了语言!");
Debug.Log(texts[0].text);
}
}

@ -1,196 +0,0 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class NewBehaviourScript : MonoBehaviour
{
// 摄像机位置
public Transform cameraTransform;
// 摄像机距离人物的距离
public float cameraDistance;
// 游戏管理器
public GameManager gameManager;
// 前进移动速度
float moveVSpeed;
// 水平移动速度
public float moveHSpeed = 5.0f;
// 跳跃高度
public float jumpHeight = 5.0f;
// 动画播放器
Animator m_animator;
// 起跳时间
double m_jumpBeginTime;
// 跳跃标志
int m_jumpState = 0;
bool attack=false;
// 最大速度
public float maxVSpeed = 8.0f;
// 最小速度
public float minVSpeed = 5.0f;
public Score playerScore;
public float goalScore = 100000;
int uperCount = 0;
// Use this for initialization
void Start()
{
//print(11);
Time.timeScale = 1;
GetComponent<Rigidbody>().freezeRotation = true;
m_animator = GetComponent<Animator>();
if (m_animator == null)
print("null");
moveVSpeed = minVSpeed;
Debug.Log("start!!!");
gameManager.isEnd = false;
}
// Update is called once per frame
void Update()
{
// 游戏结束
if (gameManager.isEnd)
{
return;
}
if ((playerScore.distance + playerScore.bonus) >= goalScore) Application.LoadLevel(2);
if (attack) uperCount++;
if (uperCount >= 225) { Debug.Log("犯规了噢!"); gameManager.isEnd = true; }
AnimatorStateInfo stateInfo = m_animator.GetCurrentAnimatorStateInfo(0);
/*if (stateInfo.fullPathHash == Animator.StringToHash("Base Layer.run"))
{
m_jumpState = 0;
if (Input.GetButton("Jump"))
{
// 起跳
m_animator.SetBool("Jump", true);
//m_jumpBeginTime = m_animator.GetTime();
}
else
{
// 到地面
}
}
else
{
//double nowTime = m_animator.GetTime();
//double deltaTime = nowTime - m_jumpBeginTime;
// 掉下
m_jumpState = 1;
m_animator.SetBool("Jump", false);
}*/
float h = Input.GetAxis("Horizontal");
Vector3 vSpeed = new Vector3(this.transform.forward.x, this.transform.forward.y, this.transform.forward.z) * moveVSpeed;
Vector3 hSpeed = new Vector3(this.transform.right.x, this.transform.right.y, this.transform.right.z) * moveHSpeed * h;
Vector3 jumpSpeed = new Vector3(this.transform.up.x, this.transform.up.y, this.transform.up.z) * jumpHeight * m_jumpState;
Vector3 vCameraSpeed = new Vector3(this.transform.forward.x, this.transform.forward.y, this.transform.forward.z) * minVSpeed;
this.transform.position += (vSpeed + hSpeed + jumpSpeed) * Time.deltaTime;
cameraTransform.position += (vCameraSpeed) * Time.deltaTime;/*
// 当人物与摄像机距离小于cameraDistance时 让其加速
if (this.transform.position.x - cameraTransform.position.x < cameraDistance)
{
moveVSpeed += 0.1f;
if (moveVSpeed > maxVSpeed)
{
moveVSpeed = maxVSpeed;
}
}*/
// 超过时 让摄像机赶上
/*else*/ if (this.transform.position.x - cameraTransform.position.x > cameraDistance)
{
//moveVSpeed = minVSpeed;
cameraTransform.position = new Vector3(this.transform.position.x - cameraDistance, cameraTransform.position.y, cameraTransform.position.z);
}
// 摄像机超过人物或者掉落
/*if ((cameraTransform.position.x - this.transform.position.x > 0.0001f)|| (this.transform.position.y< 0f))
{
Debug.Log("camera!!!你输啦!!!!!!!!!!");
gameManager.isEnd = true;
}*/
if (Input.GetKeyDown(KeyCode.DownArrow)) attack = true;
if (Input.GetKeyUp(KeyCode.DownArrow)) { attack = false; Debug.Log("发送keyup");uperCount = 0; }
//cameraTransform.position = new Vector3(this.transform.position.x - cameraDistance, cameraTransform.position.y, cameraTransform.position.z);
}
void OnGUI()
{
if (gameManager.isEnd)
{
GUIStyle style = new GUIStyle();
style.alignment = TextAnchor.MiddleCenter;
style.fontSize = 40;
style.normal.textColor = Color.white;
GUI.Label(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 50, 200, 100), "你输了~", style);
Time.timeScale = 0;
if (GUI.Button(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 200, 150, 75), "Restart"))
{
//attack = false;
//Debug.Log("按了重来");
Application.LoadLevel(1);
}
if (GUI.Button(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 100, 150, 75), "Quit"))
{
Application.LoadLevel(0);
}
}
}
void OnTriggerEnter(Collider other)
{
// 如果是抵达点
if (other.name.Equals("ArrivePos"))
{
gameManager.changeRoad(other.transform);
}
// 如果是透明墙
else if (other.tag.Equals("AlphaWall"))
{
;
}
// 如果是障碍物
else if ( attack && other.tag.Equals("Obstacle"))
{
Debug.Log("按了攻击");
attack = false;
GameObject.Destroy(other.gameObject);
}
else if (other.tag.Equals("Obstacle"))
{
gameManager.isEnd = true;
//SceneManager.LoadScene(0);
Time.timeScale = 0;
Debug.Log("你输了~");
}
else if (other.tag.Equals("Tool"))//是prop层的节点撞的我
{
Tool p = other.GetComponent<Tool>();//获得撞我的节点的prop组件
switch (p.Tool_type)//判断道具类型
{
case 1:
Debug.Log("你捡到了金币分数加1000");//不同的道具做不同的处理
playerScore.bonus += 10000;
break;
case 2:
Debug.Log("加速道具,速度提升。");
moveVSpeed += 1f;
print(moveVSpeed);
break;
}
}
}
}

@ -1,27 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Score : MonoBehaviour
{
public Transform character;
public Text ScoreText;
public float distance=0;
public int bonus = 0;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
distance = character.transform.position.x * 100;
ScoreText.text = "Scores "+ (distance+bonus).ToString("0");
//ScoreText.text = "Scores " + x;
// x++;
}
}

@ -1,17 +0,0 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Tool : MonoBehaviour
{
public int Tool_type;//道具类型,这里做基类不赋予具体值
void OnTriggerEnter(Collider c)//这里的c指的都是撞我的节点不是自己
{
//Debug.Log("道具说:" + c.gameObject.name + c.gameObject.layer);
if (c.tag.Equals("Player"))// 是player撞的我, 可以在这里写一些播放特效的代码
{
GameObject.Destroy(this.gameObject);
}
}
}

@ -1,26 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class change : MonoBehaviour
{
private Animator m_Animator = null;
// Start is called before the first frame update
void Start()
{
m_Animator = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
//if (Input.GetKeyDown(KeyCode.LeftArrow))
//m_Animator.SetInteger("ActionID", 1);
//if (Input.GetKeyDown(KeyCode.RightArrow))
// m_Animator.SetInteger("ActionID", 2);
if (Input.GetKeyDown(KeyCode.Space) | Input.GetKeyDown(KeyCode.DownArrow))
m_Animator.SetInteger("ID", 1);
if (Input.GetKeyUp(KeyCode.Space) | Input.GetKeyUp(KeyCode.DownArrow))
m_Animator.SetInteger("ID", 0);
}
}

@ -1,125 +0,0 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Controller : MonoBehaviour
{
// 摄像机位置
public Transform cameraTransform;
// 摄像机距离人物的距离
public float cameraDistance;
// 游戏管理器
public MapManager mapManager;
public List<Player> players = new List<Player>();
// 动画播放器
Animator m_animator;
// Use this for initialization
void Start()
{
Time.timeScale = 1;
GetComponent<Rigidbody>().freezeRotation = true;
m_animator = GetComponent<Animator>();
if (m_animator == null)
print("null");
//moveVSpeed = minVSpeed;
}
// Update is called once per frame
void Update()
{
// 游戏结束
if (mapManager.isEnd)
{
return;
}
AnimatorStateInfo stateInfo = m_animator.GetCurrentAnimatorStateInfo(0);
if (stateInfo.fullPathHash == Animator.StringToHash("Base Layer.run"))
{
players[mapManager.mapFlag].m_jumpState = 0;
if (Input.GetButton("Jump"))
{
// 起跳
m_animator.SetBool("Jump", true);
// m_jumpBeginTime = m_animator.GetTime();
}
else
{
// 到地面
}
}
else
{
//double nowTime = m_animator.GetTime();
//double deltaTime = nowTime - m_jumpBeginTime;
// 掉下
players[mapManager.mapFlag].m_jumpState = 1;
m_animator.SetBool("Jump", false);
}
// 摄像机超过人物
if (cameraTransform.position.x - players[mapManager.mapFlag].transform.position.x > 0.0001f)
{
Debug.Log("你输啦!!!!!!!!!!");
mapManager.isEnd = true;
}
//cameraTransform.position = new Vector3(this.transform.position.x - cameraDistance, cameraTransform.position.y, cameraTransform.position.z);
}
void OnGUI()
{
if (mapManager.isEnd)
{
GUIStyle style = new GUIStyle();
style.alignment = TextAnchor.MiddleCenter;
style.fontSize = 40;
style.normal.textColor = Color.red;
GUI.Label(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 50, 200, 100), "你输了~", style);
}
}
[System.Obsolete]
void OnTriggerEnter(Collider other)
{
// 如果是抵达点
if (other.name.Equals("ArrivePos"))
{
//gameManager.changeRoad(other.transform);
mapManager.maps[mapManager.mapFlag].changeRoad(other.transform);
}
// 如果是透明墙
else if (other.tag.Equals("AlphaWall"))
{
// 没啥事情
}
// 如果是障碍物
else if (other.tag.Equals("Obstacle"))
{
Application.LoadLevel(0);
}
else if (other.tag.Equals("Tool"))//是prop层的节点撞的我
{
Tool p = other.GetComponent<Tool>();//获得撞我的节点的prop组件
switch (p.Tool_type)//判断道具类型
{
case 1:
Debug.Log("你捡到了金币分数加1");//不同的道具做不同的处理
break;
case 2:
Debug.Log("你捡到了加速器速度加5");
players[mapManager.mapFlag].moveVSpeed += 5;
break;
}
}
}
}

@ -1,59 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
//using UnityEngine.SceneManagement;
public class GameMenu : MonoBehaviour
{
[SerializeField]
public Transform UIPanel;
public Transform HelpingPanel;// Start is called before the first frame update
public Transform SettingPanel;
public MusicPlayer musicPlayer;
public Transform SettingsButtonvoice;
bool clickSetting=false;
void Start()
{
HelpingPanel.gameObject.SetActiveRecursively(false);
SettingPanel.gameObject.SetActiveRecursively(false);
SettingsButtonvoice.gameObject.SetActiveRecursively(false);
}
// Update is called once per frame
void Update()
{
}
public void StartGame()
{
Application.LoadLevel(1);//跳转到游戏场景
//SceneManager.LoadScene(1);
}
public void Buttonvoice() {
SettingsButtonvoice.gameObject.SetActiveRecursively(true);
}
public void Settings()
{
SettingPanel.gameObject.SetActiveRecursively(true);//跳转到设置界面
clickSetting = true;
SettingsButtonvoice.gameObject.SetActiveRecursively(false);
}
public void Help()
{
HelpingPanel.gameObject.SetActiveRecursively(true);
//Application.LoadLevel(0);
}
public void Back()
{
SettingPanel.gameObject.SetActiveRecursively(false);
HelpingPanel.gameObject.SetActiveRecursively(false);
musicPlayer.needShow = false;
}
public void Quit()
{
UnityEditor.EditorApplication.isPlaying = false;
Application.Quit();
}
}

@ -1,89 +0,0 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Map : MonoBehaviour
{
// 生成障碍物点列表
public List<Transform> bornPosList = new List<Transform>();
// 道路列表
public List<Transform> roadList = new List<Transform>();
// 抵达点列表
public List<Transform> arrivePosList = new List<Transform>();
// 障碍物列表
public List<GameObject> objPrefabList = new List<GameObject>();
//public List<GameObject> toolList = new List<GameObject>();
// 目前的障碍物
Dictionary<string, List<GameObject>> objDict = new Dictionary<string, List<GameObject>>();
public int roadDistance;
public bool isEnd = false;
// Use this for initialization
[System.Obsolete]
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void initMap()
{
foreach (Transform road in roadList)
{
List<GameObject> objList = new List<GameObject>();
objDict.Add(road.name, objList);
}
initRoad(0);
initRoad(1);
}
// 切出新的道路
[System.Obsolete]
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;
}
}
[System.Obsolete]
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);
}
}
}

@ -1,25 +0,0 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class MapManager : MonoBehaviour
{
public List<Map> maps = new List<Map>();
//public Map[] maps=new Map[2];
public bool isEnd = false;
public int mapFlag = 0;
public void createMap()
{
maps[mapFlag].initMap();
}
public void changeMapFlag()
{
mapFlag += 1;
}
public void changeState()
{
if (!isEnd) isEnd = true;
else isEnd = false;
}
}

@ -1,196 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MusicPlayer : MonoBehaviour
{
//将准备好的MP3格式的背景声音文件拖入此处
bool needShow = false;
public AudioClip backgroundMusic;
//将准备好的MP3格式的音效文件拖入此处
public AudioClip palyOnceSound;
//按钮音效
public AudioClip buttonSound;
//用于控制声音的AudioSource组件
private AudioSource _audioSource;
//是否播放游戏背景音乐
private bool isPlayMusic=true;
//是否播放按键音效
private bool isPlayButtonSound;
void Awake()
{
//在添加此脚本的对象中添加AudioSource组件此处为摄像机
_audioSource = this.gameObject.AddComponent<AudioSource>();
//设置循环播放
_audioSource.loop = true;
//设置音量为最大区间在0-1之间
_audioSource.volume = 1.0f;
//设置audioClip
_audioSource.clip = backgroundMusic;
if (isPlayMusic) _audioSource.Play();
}
void Update()
{
//如果isPlayMusic为false,则暂停播放背景音乐
if (isPlayMusic == false) _audioSource.Pause();
}
public void show()
{
if (!needShow) needShow = true;
else needShow = false;
}
void OnGUI()
{
if (needShow)
{
//绘制播放按钮并设置其点击后的处理
if (GUI.Button(new Rect(10, 10, 80, 30), "Play"))
{
//播放声音
if (isPlayMusic) _audioSource.Play();
AddBtnSound();
}
//绘制暂停按钮并设置其点击后的处理
if (GUI.Button(new Rect(10, 50, 80, 30), "Pause"))
{
//暂停声音,暂停后再播放,则声音为继续播放
_audioSource.Pause();
AddBtnSound();
}
//绘制停止按钮并设置其点击后的处理
if (GUI.Button(new Rect(10, 90, 80, 30), "Stop"))
{
//停止播放,停止后再播放,则声音为从头播放
_audioSource.Stop();
AddBtnSound();
}
//绘制添加音效按钮,PlayOnShot方式添加音效
/*if (GUI.Button(new Rect(100, 10, 150, 30), "AddSound_Method_1"))
{
_audioSource.PlayOneShot(palyOnceSound);
AddBtnSound();
}
//绘制添加音效按钮PlayClipAtPoint方式添加音效
if (GUI.Button(new Rect(100, 50, 150, 30), "AddSound_Method_2"))
{
AudioSource.PlayClipAtPoint(palyOnceSound, _audioSource.transform.localPosition);
AddBtnSound();
}*/
//音量控制Label
GUI.Label(new Rect(10, 130, 100, 30), "音量大小调节");
//音量控制slider
_audioSource.volume = GUI.HorizontalSlider(new Rect(120, 130, 100, 20), _audioSource.volume, 0.0f, 1.0f);
//选择是否播放背景音乐
isPlayMusic = GUI.Toggle(new Rect(10, 170, 100, 20), isPlayMusic, "背景音乐");
//选择是否播放按键声音
isPlayButtonSound = GUI.Toggle(new Rect(120, 170, 100, 20), isPlayButtonSound, "按钮音效");
}
}
//添加按键声音
private void AddBtnSound()
{
if (isPlayButtonSound) AudioSource.PlayClipAtPoint(buttonSound, _audioSource.transform.localPosition);
}
}

@ -1,69 +0,0 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Player : MonoBehaviour
{
// 摄像机位置
public Transform cameraTransform;
// 摄像机距离人物的距离
public float cameraDistance;
// 前进移动速度
public float moveVSpeed;
// 水平移动速度
public float moveHSpeed = 5.0f;
// 跳跃高度
public float jumpHeight = 5.0f;
// 动画播放器
//Animator m_animator;
// 起跳时间
double m_jumpBeginTime;
// 跳跃标志
public int m_jumpState = 0;
// 最大速度
public float maxVSpeed = 8.0f;
// 最小速度
public float minVSpeed = 5.0f;
void Start()
{
Time.timeScale = 1;
/*GetComponent<Rigidbody>().freezeRotation = true;
m_animator = GetComponent<Animator>();
if (m_animator == null)
print("null");*/
moveVSpeed = minVSpeed;
}
void Update()
{
move();
// 当人物与摄像机距离小于cameraDistance时 让其加速
if (this.transform.position.x - cameraTransform.position.x < cameraDistance)
{
moveVSpeed += 0.1f;
if (moveVSpeed > maxVSpeed)
{
moveVSpeed = maxVSpeed;
}
}
// 超过时 让摄像机赶上
else if (this.transform.position.x - cameraTransform.position.x > cameraDistance)
{
moveVSpeed = minVSpeed;
cameraTransform.position = new Vector3(this.transform.position.x - cameraDistance, cameraTransform.position.y, cameraTransform.position.z);
}
}
public void move()
{
float h = Input.GetAxis("Horizontal");
Vector3 vSpeed = new Vector3(this.transform.forward.x, this.transform.forward.y, this.transform.forward.z) * moveVSpeed;
Vector3 hSpeed = new Vector3(this.transform.right.x, this.transform.right.y, this.transform.right.z) * moveHSpeed * h;
Vector3 jumpSpeed = new Vector3(this.transform.up.x, this.transform.up.y, this.transform.up.z) * jumpHeight * m_jumpState;
Vector3 vCameraSpeed = new Vector3(this.transform.forward.x, this.transform.forward.y, this.transform.forward.z) * minVSpeed;
this.transform.position += (vSpeed + hSpeed + jumpSpeed) * Time.deltaTime;
cameraTransform.position += (vCameraSpeed) * Time.deltaTime;
}
}

@ -1,17 +0,0 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Tool : MonoBehaviour
{
public int Tool_type;//道具类型,这里做基类不赋予具体值
void OnTriggerEnter(Collider c)//这里的c指的都是撞我的节点不是自己
{
//Debug.Log("道具说:" + c.gameObject.name + c.gameObject.layer);
if (c.tag.Equals("Player"))// 是player撞的我, 可以在这里写一些播放特效的代码
{
GameObject.Destroy(this.gameObject);
}
}
}

@ -1,87 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class escape : MonoBehaviour
{
//[SerializeField]
public Transform UIPanel; //Will assign our panel to this variable so we can enable/disable it
//[SerializeField]
public Text scoreText; //Will assign our Time Text to this variable so we can modify the text it displays.
bool isPaused; //Used to determine paused state
// private bool flag = false;
// Start is called before the first frame update
[System.Obsolete]
void Start()
{
isPaused = false;
UIPanel.gameObject.SetActiveRecursively(false);
scoreText.gameObject.SetActive(false);
}
// Update is called once per frame
[System.Obsolete]
void Update()
{
scoreText.text = "Score Since Startup: " + Time.timeSinceLevelLoad;
if (Input.GetKeyDown(KeyCode.Escape))
{
if (!isPaused)
Pause();
else if (isPaused)
UnPause();
}
}
[System.Obsolete]
public void Pause()
{
Time.timeScale = 0f; //pause the game
isPaused = true;
UIPanel.gameObject.SetActiveRecursively(true); //turn on the pause menu
scoreText.gameObject.SetActive(true);
}
[System.Obsolete]
public void UnPause()
{
Time.timeScale = 1; //resume game
isPaused = false;
UIPanel.gameObject.SetActiveRecursively(false); //turn off pause menu
scoreText.gameObject.SetActive(false);
}
public void Resume()
{
UnPause();
}
public void QuitGame()
{
Application.LoadLevel(0);
}
public void Restart()
{
Application.LoadLevel(1);
}
public void Next()
{
Application.LoadLevel(2);
}
/* void Show()
{
gameObject.GetComponent<CanvasGroup>().alpha = 1;
}
void Hide()
{
gameObject.GetComponent<CanvasGroup>().alpha = 0;
}*/
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 602 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 KiB

@ -1,11 +0,0 @@
1.人物模型(暂缺)
2.场景模型(暂缺)
3.道具模型(暂缺)
4.设置界面(暂缺)
5.帮助界面(暂缺)
6.根据分数切换场景(暂缺)
7.加速道具(暂缺)
8.按钮音效(暂缺)
9.障碍物模型(暂缺)
10.UI界面优化
11.代码优化

@ -1,53 +0,0 @@
1.第一关障碍物模型选择
石头、木土、骷髅
2.第一关人物模型选择
原始人、猩猩、动物 、或者单细胞
2.第一关道路模型选择
森林、简单、动物
3.第一关道具模型选择(加速,加分)
火把、鸡腿、鸡蛋、肉
4.第二关障碍物模型选择
投石器、军队模型、木桶、法老的猫
5.第二关道路模型选择
偏棕色、古朴
6.第二关道具模型选择(加速,加分)
剑、盾
7.开始界面BGM选择
祥和
8.第一关BGM选择
活泼
9.第二关BGM选择
沉重、激昂
10.按钮音乐选择
11.摄像机镜头视角改动(待定)
12.第一关人物攻击脚本
13.帮助界面
美化
14.语言设置
15.优化代码
15.空气墙碰撞方法重写
可掉落、人物高度判定死亡
16.彩蛋(按多次)(如果可以的话)
分数达到特定、透明按钮点击、藏在角落

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,9 +0,0 @@
123
<<<<<<< HEAD
466123123123
=======
466
566
>>>>>>> luo
Loading…
Cancel
Save