FlappyBird视频代码Word文档下载推荐.docx

上传人:b****6 文档编号:18791679 上传时间:2023-01-01 格式:DOCX 页数:8 大小:16.69KB
下载 相关 举报
FlappyBird视频代码Word文档下载推荐.docx_第1页
第1页 / 共8页
FlappyBird视频代码Word文档下载推荐.docx_第2页
第2页 / 共8页
FlappyBird视频代码Word文档下载推荐.docx_第3页
第3页 / 共8页
FlappyBird视频代码Word文档下载推荐.docx_第4页
第4页 / 共8页
FlappyBird视频代码Word文档下载推荐.docx_第5页
第5页 / 共8页
点击查看更多>>
下载资源
资源描述

FlappyBird视频代码Word文档下载推荐.docx

《FlappyBird视频代码Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《FlappyBird视频代码Word文档下载推荐.docx(8页珍藏版)》请在冰豆网上搜索。

FlappyBird视频代码Word文档下载推荐.docx

,"

Button2"

Button3"

};

foreach 

(string 

name 

in 

btnnames) 

GameObject 

obj 

GameObject.Find 

(name);

Button 

btn 

obj.GetComponent<

Button>

();

btn.onClick.AddListener 

(delegate() 

this.OnClick(obj);

});

}

OnClick(GameObject 

obj){

switch 

(obj.name) 

case 

"

GameManager.Instance.Difficulty 

1;

//SceneManager.LoadScene 

("

GameScene"

);

break;

2;

3;

default:

2.TextDifficulityScript

TextDifficulityScript 

string 

difficultyID 

GameManager.Instance.DifficultyID;

TextDifficulty"

).GetComponent<

Text>

().text=difficultyID;

Update 

is 

called 

once 

per 

frame

3.GameManager

GameManager 

private 

static 

instance=null;

GameManager(){

Instance 

get 

if 

(instance 

== 

null) 

instance 

new 

return 

instance;

//************************************************

int 

score=0;

Score{

get{ 

score;

set{ 

score 

value;

ScroeUp(){

++score;

//----------------不同难度----------------

float 

pipeMoveSpeed=0.0f;

restartInterval=0.0f;

radomForY=0.0f;

;

Difficulty{

(value) 

1:

pipeMoveSpeed 

0.2f;

restartInterval 

4.0f;

radomForY 

0.0f;

菜鸟级"

2:

0.4f;

2.0f;

普通级"

3:

=1f;

1.0f;

0.5f;

专家级"

SceneManager.LoadScene 

DifficultyID{

difficultyID;

RestartInterval{

restartInterval;

}}

RadomForY{

radomForY;

PipeMoveSpeed{

pipeMoveSpeed;

UpdateScore(){

record 

PlayerPrefs.GetInt 

record"

(this.score 

>

record) 

PlayerPrefs.SetInt 

this.score);

GetRecord(){

record;

4.PipeScript

PipeScript 

bool 

isUpdating 

false;

this.GoBackWait 

(!

this.isUpdating) 

return;

speed 

GameManager.Instance.PipeMoveSpeed;

-speed*Time.deltaTime;

gameObject.transform.position 

+= 

Vector3 

(x, 

0.0f, 

0.0f);

(gameObject.transform.position.x 

<

-4.5f) 

GoBackWait(){

range 

GameManager.Instance.RadomForY;

Random.Range(-range, 

range);

Vector3(4.5f,y,0.0f);

restart(){

true;

IsUpdating{//访问器,在GameSceneManager.cs中会获取isUpdating的值

get{

isUpdating;

5.FloorScript

FloorScript 

-speed* 

Time.deltaTime;

-10) 

(10.0f, 

6.BirdScript

BirdScript 

Rigidbody2D 

rigid2D=null;

AudioSource 

flysound 

null;

hitsound 

this.rigid2D 

gameObject.GetComponent<

Rigidbody2D>

//this.flysound 

AudioSource>

(Input.GetMouseButtonDown 

(0)) 

this.rigid2D.velocity 

=new 

Vector2(0.0f, 

5.0f);

this.flysound.Play 

OnCollisionEnter2D(Collision2D 

other){

tag 

other.collider.tag;

if(tag=="

pipecollider"

||tag=="

floor"

){

this.hitsound.Play 

this.die 

die(){

GameOverScene"

}

7.GameSceneScript

GameSceneScript 

GameObject[] 

pipes=null;

this.pipes 

GameObject.FindGameObjectsWithTag 

pipe"

StartCoroutine 

IntervalCallee"

StartOnePipe(){

(int 

0;

pipes.Length;

i++) 

pipe=this.pipes 

[i].GetComponent<

PipeScript>

pipe.IsUpdating) 

pipe.restart 

IEnumerator 

IntervalCallee(){//counter

interval 

GameManager.Instance.RestartInterval;

yield 

WaitForSeconds 

(interval);

this.StartOnePipe 

8.ScroeTriggerScript

ScroeTriggerScript 

Text 

TextScore=null;

scoresound 

this.TextScore 

TextScore"

).GetComponent 

this.scoresound 

OnTriggerExit2D(Collider2D 

(other.name 

bird"

) 

GameManager.Instance.ScroeUp 

().ToString 

this.TextScore.text 

Score:

this.scoresound.Play();

9.GameOverScene

GameOverScene 

time 

TextThisTime"

time.text 

本次成绩:

+GameManager.Instance.Score.ToString();

TextRecord"

record.text 

记录:

GameManager.Instance.GetRecord().ToString();

GameManager.Instance.UpdateScore 

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1