日本語でスクリプトを書いてみよう
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 新しい振る舞いのスクリプト : MonoBehaviour { | |
bool 動いたかどうかのフラグ; | |
Vector3 フォースは我と共にあり = new Vector3(10f, 10f, 0f); | |
void Start(){ | |
Debug.Log("新しい振る舞いのスクリプトが呼ばれている"); | |
} | |
void FixedUpdate(){ | |
if (Time.frameCount < 10){ | |
return; | |
} | |
if (!動いたかどうかのフラグ){ | |
gameObject.GetComponent<Rigidbody>().AddForce(フォースは我と共にあり, ForceMode.Impulse); | |
動いたかどうかのフラグ = true; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment