首页 > 其他 > 详细

子弹代码

时间:2020-07-02 12:56:35      阅读:60      评论:0      收藏:0      [点我收藏+]
 1 using System.Collections;
 2 using System.Collections.Generic;
 3 using UnityEngine;
 4 
 5 public class Bullet : MonoBehaviour {
 6     public float moveSpeed = 5f; 
 7     // Use this for initialization
 8     void Start () {
 9         
10     }
11     
12     // Update is called once per frame
13     void Update () {
14         transform.Translate(transform.up * moveSpeed * Time.deltaTime, Space.World); //子弹的移动
15     }
16 
17     //触发进入
18     public void OnTriggerStart2D(Collider2D col)
19     {
20         Debug.Log("触发进入");
21         print("触发进入");
22     }
23 
24 
25     //触发持续
26     public void OnTriggerEndter2D(Collider2D col)
27     {
28         print("触发持续");
29     }
30 
31     //触发结束
32     public void OnTriggerExit(Collider2D col)
33     {
34         print("触发结束");
35     }
36 }

 

子弹代码

原文:https://www.cnblogs.com/yangguolin/p/13223820.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!