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");
11         birdTransform = bird.transform;
12     }
13
14     // Update is called once per frame
15     void Update () {
16         Vector3 birdPosition = birdTransform.position;
17         //保证摄像机中不出现游戏外的场景
18         float cam_y = birdPosition.y - 1.1148f;   //摄像机的y
19         if (cam_y > 1.6f)
20             cam_y = 1.6f;
21         if (cam_y < -1.5f)
22             cam_y = -1.5f;
23
24         this.transform.position = new Vector3(birdPosition.x + 2.22084f,
25             cam_y, birdPosition.z - 13.917f);
26     }
27 }
时间: 2024-10-06 17:13:13

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

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 案例代码_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 == GameM

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