無重力ビームの作成(クラスの継承)




無重力ビーム
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ZeroGravityBeam : BeamBase // ★追加
{
public override void OnTriggerEnter(Collider other)
{
base.OnTriggerEnter(other);
if(other.attachedRigidbody)
{
// 重力をオフにする
other.attachedRigidbody.useGravity = false;
AudioSource.PlayClipAtPoint(Sound, Camera.main.transform.position);
}
}
}



【2021版】X_Mission(全34回)
他のコースを見る



無重力ビーム
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ZeroGravityBeam : BeamBase // ★追加
{
public override void OnTriggerEnter(Collider other)
{
base.OnTriggerEnter(other);
if(other.attachedRigidbody)
{
// 重力をオフにする
other.attachedRigidbody.useGravity = false;
AudioSource.PlayClipAtPoint(Sound, Camera.main.transform.position);
}
}
}



無重力ビームの作成(クラスの継承)