//出撃可能エリアにユニットを描画 public void DrawUnit() { CharaData loaddata = ScriptableObject.Instantiate(Resources.Load(string.Format("BattleChara/{0}", unit.savescobj)) as CharaData); unit.gobj = MonoBehaviour.Instantiate(loaddata.gobj, new Vector3(), Quaternion.identity); foreach (int[] pos in CharaSetup.unitsetposlist) { //キャラが居なければ生成 if (!BattleVal.id2index.ContainsKey(string.Format("{0},{1}", pos[0], pos[1]))) { //描画 Mapclass.DrawCharacter(unit.gobj, pos[0], pos[1]); unit.gobj.layer = 8; unit.x = pos[0]; unit.y = pos[1]; //unitlistへの登録 BattleVal.unitlist.Add(unit); //id2indexへの登録 BattleVal.id2index.Add(string.Format("{0},{1}", pos[0], pos[1]), unit); ////mapdataにユニット情報を登録 BattleVal.mapdata[(int)MapdataList.MAPUNIT][unit.y][unit.x] = 99; //ユニット番号はcsvから読み取るときしか使わないため、1から99なら何でもよい //足元にチーム識別タイルを GameObject unittile; unittile = Instantiate(prefabPlayerTile, unit.gobj.transform); unittile.transform.localScale = new Vector3(unittile.transform.localScale.x / unittile.transform.lossyScale.x, 0.01f, unittile.transform.localScale.z / unittile.transform.lossyScale.z); Mapclass.DrawCharacter(unittile, unit.x, unit.y); break; } } }
//attackablelistを表示するだけ public static void Show_Attackablelist() { //表示処理 foreach (int[] mappos in attackablelist) { GameObject tmptile = Instantiate(attackabletile); tilelist.Add(tmptile); Mapclass.DrawCharacter(tilelist[tilelist.Count - 1], mappos[0], mappos[1]); } }
public static void Show_Movablelist() { //表示処理 foreach (int[] mappos in movablelist) { if (!BattleVal.zocmap[mappos[0], mappos[1]]) { tilelist.Add(Instantiate(movabletile)); } if (BattleVal.zocmap[mappos[0], mappos[1]]) { tilelist.Add(Instantiate(zoctile)); } Mapclass.DrawCharacter(tilelist[tilelist.Count - 1], mappos[0], mappos[1]); } }
//attackablelistを表示するだけ public static void Show_Attackablelist() { //表示処理 foreach (int[] mappos in attackablelist) { GameObject tmptile; //回復かどうか if (selectedskill.s_atk < 0) { tmptile = Instantiate(healabletile); } else { tmptile = Instantiate(attackabletile); } tilelist.Add(tmptile); Mapclass.DrawCharacter(tilelist[tilelist.Count - 1], mappos[0], mappos[1]); } }
//攻撃エリアの描画 public static void Show_Attackarea() { //消去処理 Destroy_Areatile(); //表示処理 foreach (int[] mappos in attackkingarea) { GameObject tmptile; //回復かどうか if (selectedskill.s_atk < 0) { tmptile = Instantiate(healareatile); } else { tmptile = Instantiate(attackareatile); } areatilelist.Add(tmptile); Mapclass.DrawCharacter(areatilelist[areatilelist.Count - 1], mappos[0], mappos[1]); } }
//ユニット設置可能なマスにタイルを描く void DrawTile() { unitsetposlist.Clear(); for (int i = 0; i < Mapclass.mapxnum; i++) { for (int j = 0; j < Mapclass.mapynum; j++) { if (BattleVal.mapdata[(int)MapdataList.MAPUNITSET][j][i] == 1) { unitsetlist.Add(Instantiate(UnitSetTile)); Mapclass.DrawCharacter(unitsetlist[unitsetlist.Count - 1], i, j); //1つ目の座標に視点移動 if (unitsetposlist.Count == 0) { Vector3 temp = new Vector3(); Mapclass.TranslateMapCoordToPosition(ref temp, i, j); CameraAngle.CameraPoint(temp); } unitsetposlist.Add(new int[] { i, j }); } } } }
//位置変更するパーティユニットのタイル色を変更 void SetChangeTile() { UnitChangeTile = Instantiate(UnitChangeTilePrefab, new Vector3(), Quaternion.identity); Mapclass.DrawCharacter(UnitChangeTile, BattleVal.selectX, BattleVal.selectY); }