// Use this for initialization void Start () { var enemyGrid = GameObject.Find("EnemyGrid"); for(var i = 1; i <= 10; i++) { var bot = new csBot(i); bots.Add(bot); GameObject prefab = (GameObject)Resources.Load("Prefabs/UI/Bot Profile"); if (prefab != null) { var clone = (GameObject)Instantiate(prefab); clone.name = prefab.name; var profList = clone.GetComponent<csBotProfileList>(); profList.Name = bot.Name; profList.Level = bot.Level; profList.Avatar.sprite = bot.Avatar; clone.transform.SetParent(enemyGrid.transform, false); var buttons = clone.GetComponentsInChildren<Button>(); foreach(var button in buttons) { if(button.name == "btnBotFight") { button.gameObject.AddComponent<csButtonData>().Data = bot; } } } } }
// Use this for initialization void Start () { FightTurn = 1; TurnList = new List<csTurn>(); kagotchi = csGameController.control.Kagotchi; kagotchiFightPlan = csGameController.control.FightPlan; bot = csGameController.control.CurrentBot; GenerateBotPlan(); Fight(); txtPlayerName.text = kagotchi.Name; txtBotName.text = bot.Name; playerAvatar.sprite = csGameController.control.Kagotchi.Avatar; botAvatar.sprite = csGameController.control.CurrentBot.Avatar; }