// Use this for initialization void Start() { _yEndingFade = GameObject.Find("Fade").GetComponent <yEndingFade>(); _yPlayerAI = GameObject.Find("player").GetComponent <yPlayerAI>(); int n = staffRoll.Count; //配列の要素数 text = new Text[n]; textShodow = new Text[n]; textSize = new Vector2[n]; textRect = new RectTransform[n]; textShodowRect = new RectTransform[n]; Canvas canvas = GameObject.Find("Canvas").GetComponent <Canvas>(); for (int i = 0; i < text.Length; i++) { //オブジェクトの生成 textShodow[i] = Instantiate(textShodowPrefab) as Text; text[i] = Instantiate(textPrefab) as Text; //Canvasの子オブジェクト textShodow[i].transform.parent = canvas.transform; text[i].transform.parent = canvas.transform; //生成したもののサイズ text[i].transform.localScale = Vector3.one; textShodow[i].transform.localScale = Vector3.one; //高さ 幅 text[i].GetComponent <RectTransform>().sizeDelta = staffRoll[i].Size; textShodow[i].GetComponent <RectTransform>().sizeDelta = staffRoll[i].Size; //RectTransformを取得 textRect[i] = text[i].GetComponent <RectTransform>(); textShodowRect[i] = textShodow[i].GetComponent <RectTransform>(); //テキストと位置を設定 text[i].text = staffRoll[i].Text; text[i].transform.localPosition = staffRoll[i].TextPos; //テキストの影の位置 textShodow[i].text = text[i].text; textShodow[i].transform.localPosition = text[i].transform.localPosition + new Vector3(13.7f, -14.4f, 0); //サイズ textSize[i] = textRect[i].sizeDelta; textRect[i].sizeDelta = new Vector2(0, textSize[i].y); textShodowRect[i].sizeDelta = new Vector2(0, textSize[i].y); text[i].enabled = false; textShodow[i].enabled = false; } textPrefab.enabled = false; textShodowPrefab.enabled = false; }
// Use this for initialization void Start() { tim = Camera.main.GetComponent <timeover>(); player = GameObject.Find("player"); shodow = GameObject.Find("shodow"); _hMainDirector = GameObject.Find("MainDirector").GetComponent <hMainDirector>(); fadeImage = GetComponent <Image>(); fadeImage.fillAmount = 1.0f; _fshodow = shodow.GetComponent <fShodow>(); _yPlayerAI = player.GetComponent <yPlayerAI>(); }
// Use this for initialization void Start() { //スクリプトを取得 _fShodow = GameObject.Find("shodow").GetComponent <fShodow>(); _yPlayerAI = transform.parent.GetComponent <yPlayerAI>(); _yPlayerAI.enabled = false; _fShodow.enabled = false; //遅延コルーチン StartCoroutine("Delay"); }
private void OnBecameVisible() { enabled = true; _yPlayerAI = player.GetComponent <yPlayerAI>(); _yPlayerAI.Speed = 0.02f; }