摘要:
//发射一条射线,去检测玩家是否在自己面前,用来随后的发射炮弹 bool isForward = false; var TranformShootPoint = ai.WorkingMemory.GetItem("enemyShootPoint"); Ray ray = new Ray(TranformShootPoint.transform.position, TranformShootPoint.transform.forward); RaycastHit hit;//这个是碰撞检测的目标 ... 阅读全文
摘要:
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) ... 阅读全文