転職を繰り返したサラリーマンの多趣味ブログ

30才未経験でSEに転職した人の多趣味ブログ

2019-01-13から1日間の記事一覧

【Unity】一定間隔で弾を撃ち続けるスクリプト

// 弾を撃つ間隔 public float shotDelay = 3.0f; // Use this for initialization IEnumerator Start () { rb = GetComponent<Rigidbody2D>(); while (true) { shot(); yield return new WaitForSeconds(shotDelay); } } private void shot() { // プレハブ生成 Instanti</rigidbody2d>…

【Unity】キャラクターを自動で左右に移動させるスクリプト

// 移動速度 public float speed = 2.0f; // Rigidbody private Rigidbody2D rb; // Use this for initialization void Start () { rb = GetComponent<Rigidbody2D>(); } // Update is called once per frame void Update () { // 移動 move(); } private void move() { r</rigidbody2d>…

【Unity】ジャンプ処理

// ジャンプの力 public float jumpPower = 40; // ジャンプ中判定 private bool isJump = false; // 接地判定 private bool isGround = false; // Update is called once per frame void FixedUpdate () { // Playerの移動速度、方向をセット setMoveDirect…