Unity - A计划(永久有效期) 扫二维码继续学习 二维码时效为半小时

(196评价)
价格: 4039.00元
碰撞检测方法date不起作用(不输出’s‘)
张同学斯基发起了问答2016-11-28
1
回复
525
浏览
using UnityEngine;
using System.Collections;

public class ball : MonoBehaviour {
    int sum = Random.Range(0, 2);
    private Rigidbody2D rig2d;
	
	void Start ()
    {
        rig2d = GetComponent<Rigidbody2D>();
        if (sum==0)
        {
            rig2d.AddForce(new Vector2(60, 0));
        }
        else
        {
            rig2d.AddForce(new Vector2(-60, 0));
        }
   
    }
        void date(Collision2D col)
    {
        print("s");
        if (col.collider.tag == "Player")
        {
            Vector2 velocit = GetComponent<Rigidbody2D>().velocity;
            velocit.y = velocit.y / 2f + col.rigidbody.velocity.y / 2;
            GetComponent<Rigidbody2D>().velocity = velocit;

        }
    }

}
using System.Collections;

头文件是灰色的 

所有回复
发表回复
你还没有登录,请先 登录或 注册!