public void OnClickConfirm() { Debug.Log("Clicked : Confirm. " + flag.text); // 0 = Thief, 1 = Archer, 2 = Magician, 3 = Knight, 4 = Priest switch (int.Parse(flag.text)) { case 0: gameManager.AddCharacter(DataChar.getThief()); break; case 1: gameManager.AddCharacter(DataChar.getArcher()); break; case 2: gameManager.AddCharacter(DataChar.getMage()); break; case 3: gameManager.AddCharacter(DataChar.getKnight()); break; case 4: gameManager.AddCharacter(DataChar.getPriest()); break; } SceneManager.LoadScene("Intro"); }
public void OnClickTestCharacter() { List <DataChar> tempList = new List <DataChar>(); tempList.Add(DataChar.getArcher()); tempList.Add(DataChar.getArcher()); tempList.Add(DataChar.getKnight()); tempList.Add(DataChar.getKnight()); tempList.Add(DataChar.getMage()); tempList.Add(DataChar.getMage()); tempList.Add(DataChar.getPriest()); tempList.Add(DataChar.getPriest()); tempList.Add(DataChar.getThief()); tempList.Add(DataChar.getThief()); gameManager.UpdateCharacterList(tempList); }
// Start is called before the first frame update void Start() { myBattleChars = new List <GameObject>(); enemys = new List <GameObject>(); readyPlayer = new List <GameObject>(); target = new List <BattleChar>(); myBC = new List <BattleChar>(); enemyBC = new List <BattleChar>(); readyBC = new List <BattleChar>(); myDeadBC = new List <BattleChar>(); enemyDeadBC = new List <BattleChar>(); myField = new GameObject[3, 3]; enemyField = new GameObject[3, 3]; buttons = new GameObject[5]; myPosition = new int[myCharNum, 2]; enemyPos = new int[enemyNum, 2]; skills = new List <Skill>(); guarded = new List <BattleChar>(); List <DataChar> DCList = new List <DataChar>(); nullSkl = new Skill(new SkillSet()); sklSelected = nullSkl; charSize = new Vector3(2.2f, 2.2f, 2.2f); mainCam = Camera.main; camOrigin = mainCam.transform.position; camSize = mainCam.orthographicSize; floorStep = 1.5f; //버튼 객체들을 저장 for (int i = 0; i < 5; i++) { buttons[i] = skWIndow.transform.GetChild(i).gameObject; } //플레이어, AI 정보 불러오기 //필드 구성 for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { myField[i, j] = Instantiate(floor, new Vector3(i * floorStep, 0, j * floorStep), Quaternion.identity); myField[i, j].name = "my floor(" + i + "," + j + ")"; enemyField[i, j] = Instantiate(floor, new Vector3(i * floorStep + 11.5f, 0, j * floorStep), Quaternion.identity); enemyField[i, j].name = "enemy floor(" + i + "," + j + ")"; } } centerPos = (myField[1, 1].transform.position + enemyField[1, 1].transform.position) / 2; //불러온 정보를 기반으로 발판에 캐릭터 생성 및 리스트에 추가 //플레이어 캐릭터 생성 //for (int i = 0; i < myCharNum; i++) { // GameObject tmp = Instantiate(dummy, myField[i, i].transform.position, Quaternion.identity); // tmp.tag = "FRIEND"; // BattleChar bc = GetComponent<BattleChar>(); // bc.xPos = i; // bc.yPos = i; // bc.floor = myField[i, i]; // bc.tg = TARGETTAG.FRIEND; // bc.body = tmp; // myBattleChars.Add(tmp); // myBC.Add(bc); // tmp.name = "friend knight " + i +" "; //} DCList.Add(DataChar.getKnight()); DCList.Add(DataChar.getArcher()); DCList.Add(DataChar.getThief()); DCList.Add(DataChar.getMage()); DCList.Add(DataChar.getPriest()); DCList.Add(DataChar.getNormalEnemy()); DCList.Add(DataChar.getNormalEnemy()); DCList.Add(DataChar.getNormalEnemy()); //적 캐릭터 생성 for (int i = 0; i < enemyNum; i++) { GameObject tmp = Instantiate(enemyCube, enemyField[i, i].transform.position, Quaternion.identity); tmp.transform.localScale = charSize; tmp.tag = "ENEMY"; tmp.GetComponent <BattleChar>().xPos = i; tmp.GetComponent <BattleChar>().yPos = i; tmp.GetComponent <BattleChar>().floor = enemyField[i, i]; tmp.GetComponent <BattleChar>().tg = TARGETTAG.ENEMY; tmp.GetComponent <BattleChar>().body = tmp; enemys.Add(tmp); while (!tmp.GetComponent <BattleChar>()) { enemyBC.Add(tmp.GetComponent <BattleChar>()); } tmp.name = "enemy knight " + i + " "; tmp.GetComponent <BattleChar>().DC = DCList[5 + i]; } //버튼에 이벤트 리스너 부착 buttons[0].GetComponent <Button>().onClick.AddListener(delegate() { sklSelected = normal; curState = BattleState.START; }); buttons[1].GetComponent <Button>().onClick.AddListener(delegate() { sklSelected = skills[0]; curState = BattleState.START; }); buttons[2].GetComponent <Button>().onClick.AddListener(delegate() { sklSelected = skills[1]; curState = BattleState.START; }); buttons[3].GetComponent <Button>().onClick.AddListener(delegate() { sklSelected = skills[2]; curState = BattleState.START; }); buttons[4].GetComponent <Button>().onClick.AddListener(delegate() { sklSelected = skills[3]; curState = BattleState.START; }); skWIndow.SetActive(false); hit = new RaycastHit(); curState = BattleState.INIT; animStack = 0; testSpawnChar(DCList[0], 2, 2, DCList[0].cls); testSpawnChar(DCList[1], 1, 1, DCList[1].cls); testSpawnChar(DCList[2], 0, 0, DCList[2].cls); testSpawnChar(DCList[3], 0, 2, DCList[3].cls); testSpawnChar(DCList[4], 2, 0, DCList[4].cls); Invoke("afterStart", 0.001f); }