-
-
Save anonymous/55d7927393d354f3f756 to your computer and use it in GitHub Desktop.
39行目から、コルーチンが始まります。
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 UnityEngine; | |
using System.Collections; | |
using UnityEngine.UI; | |
public class PlayController : MonoBehaviour { | |
private Vector3 pos; | |
private Vector3 WorldPointPos; | |
void Start () | |
{ | |
} | |
void Update () { | |
//マウス位置座標をVector3で取得 | |
pos = Input.mousePosition; | |
// マウス位置座標をスクリーン座標からワールド座標に変換する | |
WorldPointPos = Camera.main.ScreenToWorldPoint (pos); | |
// 壁を突き抜けないようにx軸の移動範囲を限定 | |
if (WorldPointPos.x <= -2.1f) { | |
WorldPointPos.x = -2.1f; | |
} else if (WorldPointPos.x >= 2.1f) { | |
} | |
//y軸とz軸は固定 | |
WorldPointPos.y = -2.0f; | |
WorldPointPos.z = 0.0f; | |
// ワールド座標をPlayer位置へ変換 | |
gameObject.transform.position = WorldPointPos; | |
} | |
void AAAA(){ | |
StartCoroutine ("player"); | |
} | |
private IEnumerator player() { | |
transform.localScale = new Vector3(5,1,1); | |
Debug.Log ("2秒間"); | |
yield return new WaitForSeconds(2f); // 2秒間、処理を待機. | |
transform.localScale = new Vector3(3,1,1); | |
yield break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment