重力ビームの作成(クラスの継承)
![6f7bb546 31f9 4af4 a600 04a97c4412e4](https://codegenius.org/uploads/slide/image/8217/6f7bb546-31f9-4af4-a600-04a97c4412e4.jpeg)
![C9056e94 8b10 4412 81c9 3911d5f29585](https://codegenius.org/uploads/slide/image/8218/c9056e94-8b10-4412-81c9-3911d5f29585.jpeg)
![A6d9f001 3a5a 40e9 8af0 131255876064](https://codegenius.org/uploads/slide/image/8219/a6d9f001-3a5a-40e9-8af0-131255876064.jpeg)
![0d4cf5c4 d6d9 4503 b129 1da2750946ad](https://codegenius.org/uploads/slide/image/8220/0d4cf5c4-d6d9-4503-b129-1da2750946ad.jpeg)
重力ビーム
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GravityBeam : BeamBase
{
public override void OnTriggerEnter(Collider other)
{
base.OnTriggerEnter(other);
if(other.attachedRigidbody)
{
// 重力をオンにする
other.attachedRigidbody.useGravity = true;
AudioSource.PlayClipAtPoint(Sound, Camera.main.transform.position);
}
}
}
![8f9ea39e 3267 4be5 b723 7289678ea2ad](https://codegenius.org/uploads/slide/image/8221/8f9ea39e-3267-4be5-b723-7289678ea2ad.jpeg)
![53e2f050 ccbf 406f b2ca 1b688658e901](https://codegenius.org/uploads/slide/image/8222/53e2f050-ccbf-406f-b2ca-1b688658e901.jpeg)
![Dd6ff190 4842 418d ab4e 4b1f0be91c9b](https://codegenius.org/uploads/slide/image/8223/dd6ff190-4842-418d-ab4e-4b1f0be91c9b.jpeg)
![6719d121 29c5 487a 8045 c875747e12e3](https://codegenius.org/uploads/slide/image/8224/6719d121-29c5-487a-8045-c875747e12e3.jpeg)
【2021版】X_Mission(全34回)
他のコースを見る![6f7bb546 31f9 4af4 a600 04a97c4412e4](https://codegenius.org/uploads/slide/image/8217/6f7bb546-31f9-4af4-a600-04a97c4412e4.jpeg)
![C9056e94 8b10 4412 81c9 3911d5f29585](https://codegenius.org/uploads/slide/image/8218/c9056e94-8b10-4412-81c9-3911d5f29585.jpeg)
![A6d9f001 3a5a 40e9 8af0 131255876064](https://codegenius.org/uploads/slide/image/8219/a6d9f001-3a5a-40e9-8af0-131255876064.jpeg)
![0d4cf5c4 d6d9 4503 b129 1da2750946ad](https://codegenius.org/uploads/slide/image/8220/0d4cf5c4-d6d9-4503-b129-1da2750946ad.jpeg)
重力ビーム
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GravityBeam : BeamBase
{
public override void OnTriggerEnter(Collider other)
{
base.OnTriggerEnter(other);
if(other.attachedRigidbody)
{
// 重力をオンにする
other.attachedRigidbody.useGravity = true;
AudioSource.PlayClipAtPoint(Sound, Camera.main.transform.position);
}
}
}
![8f9ea39e 3267 4be5 b723 7289678ea2ad](https://codegenius.org/uploads/slide/image/8221/8f9ea39e-3267-4be5-b723-7289678ea2ad.jpeg)
![53e2f050 ccbf 406f b2ca 1b688658e901](https://codegenius.org/uploads/slide/image/8222/53e2f050-ccbf-406f-b2ca-1b688658e901.jpeg)
![Dd6ff190 4842 418d ab4e 4b1f0be91c9b](https://codegenius.org/uploads/slide/image/8223/dd6ff190-4842-418d-ab4e-4b1f0be91c9b.jpeg)
![6719d121 29c5 487a 8045 c875747e12e3](https://codegenius.org/uploads/slide/image/8224/6719d121-29c5-487a-8045-c875747e12e3.jpeg)
重力ビームの作成(クラスの継承)