예제 #1
0
        private void OnCollisionEnter(Collision collision)
        {
            var otherLayer = collision.collider.gameObject.layer;

            if ((BulletLayer & 1 << otherLayer) == 1 << otherLayer)
            {
                BulletCore bullet = collision.gameObject.GetComponent <BulletCore>();
                Harm(bullet.WeaponDescription);
            }
        }
예제 #2
0
    void RpcAddForceOnAll(GameObject bulletObj)
    {
        Rigidbody  rigid       = GetComponent <Rigidbody>();
        BulletCore bulletCore  = bulletObj.GetComponent <BulletCore>();
        Rigidbody  bulletRigid = bulletObj.GetComponent <Rigidbody>();

        Debug.Assert(bulletCore && bulletRigid);

        bulletCore.shooterObj = gameObject;
        bulletRigid.AddForce(rigid.velocity + bodyTr.up * POWER);
    }
예제 #3
0
 // Use this for initialization
 private void Awake()
 {
     bulletCore = new BulletCore(new Weapon());
     launchTime = Time.time;
 }