摘要: //发射一条射线,去检测玩家是否在自己面前,用来随后的发射炮弹 bool isForward = false; var TranformShootPoint = ai.WorkingMemory.GetItem("enemyShootPoint"); Ray ray = new Ray(TranformShootPoint.transform.position, TranformShootPoint.transform.forward); RaycastHit hit;//这个是碰撞检测的目标 ... 阅读全文
posted @ 2014-02-01 23:25 TouchAfflatus 阅读(2182) 评论(0) 推荐(0) 编辑
摘要: using UnityEngine;public class example : MonoBehaviour{ public GameObject projectilePrefab; public float fireRate = 0.5F;//0.5秒实例化一个子弹 private float nextFire = 0.0F; public float speed = 5f;//子弹速度 private void Update() { if (Input.GetButton("Fire1") && Time.time > nextFire) ... 阅读全文
posted @ 2014-02-01 23:18 TouchAfflatus 阅读(3177) 评论(0) 推荐(0) 编辑