using UnityEngine;
//using UnityEngine.UI;
using System.Collections;
public class BattleMain : MonoBehaviour{
using UnityEngine;
//using UnityEngine.UI;
using System.Collections;
public class BattleMain : MonoBehaviour{
protected int _sceneTask;
public GameObject prefab = null;
public GameObject[,] mass = new GameObject[15,15];
int isk;
int jsk;
// Use this for initialization
void Start () {
// 配置元のオブジェクト指定
GameObject stageObject = GameObject.FindWithTag("Stage");
//// タイル配置
for(int i = 0; i < 15 ; i ++) {
for(int j = 0; j < 15 ; j ++) {
Vector3 tile_pos = new Vector3(
0 + prefab.transform.localScale.x * i,
0,
0 + prefab.transform.localScale.z * j
);
if(prefab != null){
// プレハブの複製
GameObject instant_object = Instantiate(prefab,tile_pos, Quaternion.identity) as GameObject;
// 生成元の下に複製したプレハブをくっつける
instant_object.transform.parent = stageObject.transform;
mass[i,j] = instant_object;
}
}
}
int Ivent = Random.Range(4, 7);//ランダムにイベントマスの設置
for(int p = 0; p < Ivent;p++){
int iRandNum = Random.Range(0, 14);
int jRandNum = Random.Range(0, 14);
mass[iRandNum,jRandNum].GetComponent<Renderer>().material.color = new Color(0.2f, 0.8f, 0.9f, 0.5f);
}
}
// Update is called once per frame
void Update(){
mass[5,5].GetComponent<Renderer>().material.color = new Color(0.0f, 0.0f, 0.0f, 0.0f);
Debug.Log ("黒くなるはずのマス[5,5]の色は"+mass [5, 5].GetComponent<Renderer> ().material.color);
mass[1,5].GetComponent<Renderer> ().material.color = new Color (0.2f, 0.8f, 0.9f, 0.5f);
Debug.Log ("青になるはずのマス[1,5]の色は"+mass [1, 5].GetComponent<Renderer> ().material.color);
}
}
}