码迷,mamicode.com
首页 > 其他好文 > 详细

fly bird 案例代码_FlowBird

时间:2015-11-08 19:08:25      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:

 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 }

 

fly bird 案例代码_FlowBird

标签:

原文地址:http://www.cnblogs.com/wry524/p/4947818.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!