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 static DataChar getArcher() { DataChar tmp = new DataChar("Archer", 60, 45, 27.0f, 21, 11, 15, 12, 0, 0.1f); tmp.charSkillSet = new SkillArcher(); tmp.charEquipSet = new EquipSet(1); return(tmp); }
public static DataChar getThief() { DataChar tmp = new DataChar("Thief", 65, 50, 28.0f, 20, 12, 17, 12, 0, 0.1f); tmp.charSkillSet = new SkillThief(); tmp.charEquipSet = new EquipSet(0); return(tmp); }
public static DataChar getKnight() { DataChar tmp = new DataChar("Knight", 85, 30, 20.0f, 18, 15, 10, 15, 0, 0.05f); tmp.charSkillSet = new SkillKnight(); tmp.charEquipSet = new EquipSet(3); return(tmp); }
public static DataChar getEnemyDC(string Name, SkillSet set, float HP, float MP, float AP, float pATK, float pDEF, float mATK, float mDEF, float spd, float critical) { DataChar tmp = new DataChar(Name, HP, MP, AP, pATK, pDEF, mATK, mDEF, spd, critical); tmp.charSkillSet = set; tmp.charEquipSet = new EquipSet(-1); return(tmp); }
public static DataChar getPriest() { DataChar tmp = new DataChar("Priest", 60, 65, 24.0f, 12, 12, 17, 16, 0, 0.05f); tmp.charSkillSet = new SkillPriest(); tmp.charEquipSet = new EquipSet(4); return(tmp); }
public static DataChar getMage() { DataChar tmp = new DataChar("Mage", 55, 70, 25.0f, 12, 10, 22, 16, 0, 0.1f); tmp.charSkillSet = new SkillMage(); tmp.charEquipSet = new EquipSet(2); return(tmp); }
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); }
void testSpawnEnemy(DataChar dc, int i, int j, string name) { GameObject tmp = Instantiate(dummy, enemyField[i, j].transform.position, Quaternion.identity); tmp.transform.localScale = charSize; tmp.tag = "FRIEND"; tmp.GetComponent <BattleChar>().xPos = i; tmp.GetComponent <BattleChar>().yPos = j; tmp.GetComponent <BattleChar>().floor = enemyField[i, j]; tmp.GetComponent <BattleChar>().tg = TARGETTAG.FRIEND; tmp.GetComponent <BattleChar>().body = tmp; enemys.Add(tmp); while (!tmp.GetComponent <BattleChar>()) { } enemyBC.Add(tmp.GetComponent <BattleChar>()); tmp.name = name; tmp.GetComponent <BattleChar>().DC = dc; }
// 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); }
public void CharacterSelect(int index) { selectedCharacterIndex = index; selectedCharacter = characterData[index]; switch (characterData[index].cls) { case "Thief": characterImage.GetComponent <Image>().sprite = Resources.Load <Sprite>(Resource.ThiefIdle) as Sprite; characterImage.GetComponent <Image>().color = new Color(1, 1, 1, 1); OnClickSortThief(); break; case "Archer": characterImage.GetComponent <Image>().sprite = Resources.Load <Sprite>(Resource.ArcherIdle) as Sprite; characterImage.GetComponent <Image>().color = new Color(1, 1, 1, 1); OnClickSortArhcer(); break; case "Mage": characterImage.GetComponent <Image>().sprite = Resources.Load <Sprite>(Resource.MagicianIdle) as Sprite; characterImage.GetComponent <Image>().color = new Color(1, 1, 1, 1); OnClickSortMage(); break; case "Knight": characterImage.GetComponent <Image>().sprite = Resources.Load <Sprite>(Resource.KnightIdle) as Sprite; characterImage.GetComponent <Image>().color = new Color(1, 1, 1, 1); OnClickSortKnight(); break; case "Priest": characterImage.GetComponent <Image>().sprite = Resources.Load <Sprite>(Resource.PriestIdle) as Sprite; characterImage.GetComponent <Image>().color = new Color(1, 1, 1, 1); OnClickSortPriest(); break; default: Debug.Log("Error : Class is " + characterData[index].cls); break; } ShowCharacterEquipment(index); equipHead.gameObject.GetComponent <Button>().onClick.AddListener(() => { EquipmentSwap(EquipType.Head, 0); }); equipBody.gameObject.GetComponent <Button>().onClick.AddListener(() => { EquipmentSwap(EquipType.Body, 1); }); equipFoot.gameObject.GetComponent <Button>().onClick.AddListener(() => { EquipmentSwap(EquipType.Foot, 2); }); equipWeapon.gameObject.GetComponent <Button>().onClick.AddListener(() => { EquipmentSwap(EquipType.Weapon, 3); }); equipSubweapon.gameObject.GetComponent <Button>().onClick.AddListener(() => { if (characterData[index].cls == "Thief") { EquipmentSwap(EquipType.Weapon, 4); } else { EquipmentSwap(EquipType.SubWeapon, 4); } }); //TODO : Show equip, skills }
public void SetCharacterOnFormation(int x, int y, DataChar character) { formation[x, y] = characterList.IndexOf(character); Save(); }
public void AddCharacter(DataChar character) { characterList.Add(character); Save(); }