01 2017 档案

摘要:float T=0; //时间间隔,在编辑面板可以调 public float interval=1; void Update(){ //每一帧所用的时间 T+=Time.deltaTime; if(T>=interval){ //计时器归零 T=0; } } 阅读全文
posted @ 2017-01-17 21:42 咸鱼翻身记 阅读(789) 评论(0) 推荐(0)
摘要://前提是创建子弹预制体,把预制体拉进BulletPrefab里面 using UnityEngine;using System.Collections; public class game : MonoBehaviour { public GameObject BulletPrefab; // U 阅读全文
posted @ 2017-01-17 21:33 咸鱼翻身记 阅读(3025) 评论(0) 推荐(0)
摘要:using UnityEngine;using System.Collections; public class Cube : MonoBehaviour { Vector3 Caps; // Use this for initialization void Start () { //Caps = 阅读全文
posted @ 2017-01-17 21:18 咸鱼翻身记 阅读(4675) 评论(0) 推荐(0)
摘要:using UnityEngine;using System.Collections; public class CubeScript : MonoBehaviour { //脚本对象加载的时候调用 void Awake(){ Debug.Log ("Awake"); } //脚本可用的时候会被调用 阅读全文
posted @ 2017-01-17 20:26 咸鱼翻身记 阅读(164) 评论(0) 推荐(0)
摘要://使用GameObject.Find()的方法找到物体并让物体旋转 Vector3 cube = GameObject.Find("Cube").transform.position; Transform cube1 = GameObject.Find("Cube").transform; cub 阅读全文
posted @ 2017-01-17 20:22 咸鱼翻身记 阅读(5627) 评论(0) 推荐(0)
摘要:void Update () { CheckBarrier(); } void CheckBarrier() { //创建一个射线 关键字Ray //第一个参数放的是发射射线的物体的位置,第二个参数放的是发射射线的方向 Ray ray1 = new Ray(transform.position,tr 阅读全文
posted @ 2017-01-17 19:39 咸鱼翻身记 阅读(11200) 评论(0) 推荐(1)
摘要:方法1:利用虚拟轴 void Update () { 方法1:利用虚拟轴 void Update () { float hor = Input.GetAxis("Horizontal"); float ver = Input.GetAxis("Vertical"); transform.positi 阅读全文
posted @ 2017-01-17 19:03 咸鱼翻身记 阅读(8571) 评论(3) 推荐(0)