public void OnClickCaptureButton() { int AllyCount = GameObject.FindGameObjectsWithTag("Team").Length; //동료 숫자 파악. //포획 불가능. if (AllyCount - 1 >= GetPlayerStatData.playerStat.Leadership) //동료의 숫자가 Leadership 숫자를 넘지않도록, -1은 Player 자신. { return; } //포획 가능. GameObject go = FindNearestObjectByTag("IsDeadEnemy"); // 죽어있는상태 가장 가까운 적. Destroy(go.GetComponent <EnemyCtrl>()); AllyCtrl AC = go.AddComponent <AllyCtrl>() as AllyCtrl; AC.enabled = true; go.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); //다시 크기 복귀. OffCaptureButton(); //버튼 off OffGetSpoilButton(); //버튼 off }
protected override void Init2() { rb = _creature.GetComponent <Rigidbody>(); base.Init2(); //Player가 가지고 있는 Creature Name,Count 조회. Where where = new Where(); where.Equal("owner_inDate", GetPlayerStatData.playerStat.OwnerIndate); var bro = Backend.GameData.GetMyData("OwnUnitTable", where, 50); Debug.Log(bro.GetReturnValuetoJSON()["rows"].Count); for (int i = 0; i < bro.GetReturnValuetoJSON()["rows"].Count; i++) //(임시코드)가지고 있는 Creature 수까지 반복. 게임씬에는 생성.디비 테이블에선 삭제. { string Name = bro.Rows()[i]["Name"]["S"].ToString(); Debug.Log(Name); GameObject go = Managers.Resource.Instantiate($"Creature_YJ/{Name}"); Destroy(go.GetComponent <EnemyCtrl>()); AllyCtrl AC = go.AddComponent <AllyCtrl>() as AllyCtrl; AC.enabled = true; Backend.GameData.Delete("OwnUnitTable", where); } }