fly bird 案例代码_bird

 1 using UnityEngine;
 2 using System.Collections;
 3
 4 public class bird : MonoBehaviour {
 5     public float timer = 0;
 6     public int freamNumbuer = 10;
 7     public int freamCount=0;
 8
 9     void Update() {
10         //小鸟动画
11         if (GameMangger._intance.GameState == GameMangger.GAMESTATE_RUNING)
12         {
13             {
14                 timer += Time.deltaTime;
15                 if (timer >= 1.0f / freamNumbuer)
16                 {
17                     freamCount++;
18                     timer -= 1.0f / freamNumbuer;
19                     int freamIndex = freamCount % 3;
20                     this.renderer.material.SetTextureOffset("_MainTex", new Vector2(0.3333f * freamIndex, 0));
21                 }
22             }
23         }
24
25         //按鼠标左键实现小鸟跳动画
26         if (GameMangger._intance.GameState == GameMangger.GAMESTATE_RUNING)
27         {
28             {
29                 if (Input.GetMouseButtonDown(0))
30                 {
31                     audio.Play();
32                     Vector3 vel02 = this.rigidbody.velocity;
33                     this.rigidbody.velocity = new Vector3(vel02.x, 3, vel02.z);
34                 }
35             }
36         }
37     }
38     //小鸟得到生命
39     public void getLife()
40     {
41         rigidbody.useGravity = true;
42         rigidbody.velocity = new Vector3(3, 0, 0);
43     }
44 }
时间: 2024-10-22 08:46:26

fly bird 案例代码_bird的相关文章

fly bird 案例代码_GameManager

1 using UnityEngine; 2 using System.Collections; 3 4 public class GameMangger : MonoBehaviour { 5 public static int GAMESTATE_MENU = 0; //游戏菜单状态 6 public static int GAMESTATE_RUNING = 1; //游戏运行状态 7 public static int GAMESTATE_END = 2; //游戏结束状态 8 publ

fly bird 案例代码_FlowBird

1 using UnityEngine; 2 using System.Collections; 3 4 public class FollowBird : MonoBehaviour { 5 private GameObject bird; 6 private Transform birdTransform; 7 8 // Use this for initialization 9 void Start () { 10 bird = GameObject.FindWithTag("Player

fly bird 案例代码_MoveTrigger

1 using UnityEngine; 2 using System.Collections; 3 4 public class MoveTrigger : MonoBehaviour { 5 6 public Transform currentBg; 7 public pipe pipe01; 8 public pipe pipe02; 9 10 void OnTriggerEnter(Collider other) { 11 if (other.tag == "Player")

fly bird 案例代码_Pipe

1 using UnityEngine; 2 using System.Collections; 3 4 public class pipe : MonoBehaviour { 5 void Start() { 6 RandomGeneratePosition(); 7 } 8 public void RandomGeneratePosition() { 9 float pos_y = Random.Range(-0.2f, 0.1f); 10 this.transform.localPosit

fly bird 案例代码_Pipeupdown

1 using UnityEngine; 2 using System.Collections; 3 4 public class Pipeupdown : MonoBehaviour { 5 public AudioSource hitMusic; 6 public AudioSource dieMusic; 7 void OnCollisionEnter(Collision other) { 8 if (other.gameObject.tag == "Player") { 9 h

java 编程思想 22.11: java bean 案例代码

java 编程思想  22.11:   java bean 案例代码 thinking in java 4免费下载:http://download.csdn.net/detail/liangrui1988/7580155 package org.rui.swing.bean; import java.awt.Color; import java.awt.event.ActionListener; import java.awt.event.KeyListener; import org.rui.

用JS添加文本框案例代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-

银联在线支付---利用测试案例代码模拟测试应用

一.工程搭建 新建一个Web工程,命名为PayOnLine,把你下载好的案例代码拷贝到你的工程下,我的代码目录如下: acp_sdk.properties配置文件需要放在类根路劲下,里面的参数配置信息,下面是案例提供的配置提示: 0. 注意: 1)依赖包和upacp_sdk-1.0.0.jar都需加到buildpath. 2)acp_sdk.properties放到src根目录下.另外如果用的不是eclipse/MyEclipse可能这个文件默认不会被拷贝到classes目录下,导致加载不到这个

SQL Server 表的管理_关于表的操作增删查改的操作的详解(案例代码)

SQL Server 表的管理_关于表的操作增删查改的操作的详解(案例代码) 概述: 表由行和列组成,每个表都必须有个表名. SQL CREATE TABLE 语法 CREATE TABLE table_name ( column_name1 data_type(size), column_name2 data_type(size), column_name3 data_type(size), .... ); 1.查看表 exec sp_help table1; 2.创建表 create tab