無重力ビームの作成(クラスの継承)
![6fd8f018 ea93 467c ad1b 3871de026057](https://codegenius.org/uploads/slide/image/8210/6fd8f018-ea93-467c-ad1b-3871de026057.jpeg)
![37f39755 19b9 4875 b601 3605e1aacffd](https://codegenius.org/uploads/slide/image/8211/37f39755-19b9-4875-b601-3605e1aacffd.jpeg)
![Dca5b838 69dd 436c adc0 ce636782569e](https://codegenius.org/uploads/slide/image/8212/dca5b838-69dd-436c-adc0-ce636782569e.jpeg)
![144c7a9a 74e0 4ce8 b2c4 2ca4e728c7aa](https://codegenius.org/uploads/slide/image/8213/144c7a9a-74e0-4ce8-b2c4-2ca4e728c7aa.jpeg)
無重力ビーム
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);
}
}
}
![C7d15ca8 c786 4e25 ba57 b81d2589bf4a](https://codegenius.org/uploads/slide/image/8214/c7d15ca8-c786-4e25-ba57-b81d2589bf4a.jpeg)
![Fff33f4f e34f 4f88 8421 0c73dc6737f5](https://codegenius.org/uploads/slide/image/8215/fff33f4f-e34f-4f88-8421-0c73dc6737f5.jpeg)
![1b7296c1 66d3 42e2 925d 97fe0af4bd3f](https://codegenius.org/uploads/slide/image/8216/1b7296c1-66d3-42e2-925d-97fe0af4bd3f.jpeg)
【2021版】X_Mission(全34回)
他のコースを見る![6fd8f018 ea93 467c ad1b 3871de026057](https://codegenius.org/uploads/slide/image/8210/6fd8f018-ea93-467c-ad1b-3871de026057.jpeg)
![37f39755 19b9 4875 b601 3605e1aacffd](https://codegenius.org/uploads/slide/image/8211/37f39755-19b9-4875-b601-3605e1aacffd.jpeg)
![Dca5b838 69dd 436c adc0 ce636782569e](https://codegenius.org/uploads/slide/image/8212/dca5b838-69dd-436c-adc0-ce636782569e.jpeg)
![144c7a9a 74e0 4ce8 b2c4 2ca4e728c7aa](https://codegenius.org/uploads/slide/image/8213/144c7a9a-74e0-4ce8-b2c4-2ca4e728c7aa.jpeg)
無重力ビーム
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);
}
}
}
![C7d15ca8 c786 4e25 ba57 b81d2589bf4a](https://codegenius.org/uploads/slide/image/8214/c7d15ca8-c786-4e25-ba57-b81d2589bf4a.jpeg)
![Fff33f4f e34f 4f88 8421 0c73dc6737f5](https://codegenius.org/uploads/slide/image/8215/fff33f4f-e34f-4f88-8421-0c73dc6737f5.jpeg)
![1b7296c1 66d3 42e2 925d 97fe0af4bd3f](https://codegenius.org/uploads/slide/image/8216/1b7296c1-66d3-42e2-925d-97fe0af4bd3f.jpeg)
無重力ビームの作成(クラスの継承)