This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SphereBooster : MonoBehaviour { | |
// 力を加える方向 | |
Vector3 forceDirection = new Vector3(1.0f, 1.0f, 0f); | |
// 加える力の大きさ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SphereBooster : MonoBehaviour { | |
// 力を加える方向 | |
public Vector3 forceDirection = new Vector3(1.0f, 1.0f, 0f); | |
// 加える力の大きさ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SphereBooster : MonoBehaviour { | |
// 力を加える方向 | |
[SerializeField] | |
Vector3 forceDirection = new Vector3(1.0f, 1.0f, 0f); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SphereBooster : MonoBehaviour { | |
// 加える力の大きさ | |
[SerializeField] | |
float forceMagnitude = 10.0f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SphereBooster : MonoBehaviour { | |
// 加える力の大きさ | |
[SerializeField] | |
float forceMagnitude = 10.0f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 複数のAttributeの書き方 | |
// カンマ区切り | |
[SerializeField, Range(0f, 90f)] | |
float forceAngle = 45.0f; | |
// 逆もいける | |
[Range(0f, 90f), SerializeField] | |
float forceAngle = 45.0f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 相反するAttributeの実験 | |
// Inspectorに表示できるSerializeFieldと、 | |
// publicな変数であってもInspectorから隠すHideInInspectorで実験 | |
// どちらが優先されるんでしょうか。 | |
[SerializeField, HideInInspector] | |
float forceMagnitude = 10.0f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void FixedUpdate(){ | |
Debug.Log("transform x : " + gameObject.transform.position.x.ToString()); | |
Debug.Log("IsSleeping : " + rb.IsSleeping()); | |
if (!isBoostPressed){ | |
// キーまたはボタンが押されていなければ | |
// 処理の切り替えをせず抜ける | |
return; | |
} | |
// イカ省略 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 距離測定中フラグ | |
bool isCheckingDistance = false; | |
// Sphereオブジェクトの停止位置格納用ベクトル | |
Vector3 stopPosition = Vector3.zero; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void FixedUpdate(){ | |
// 距離の測定 | |
CheckDistance(); | |
if (!isBoostPressed){ | |
// キーまたはボタンが押されていなければ | |
// 処理の切り替えをせず抜ける | |
return; | |
} | |
if (isFlying){ |