protected virtual void InstantiateCharacter()
        {
            var selectedChar = _characterSelection.GetSelectedCharacter();

            //Instantiate the character based on his category and id
            var temp  = Instantiate(Resources.Load <GameObject>(_resources.Prefabs.Find(x => x.category == selectedChar.prefabCategory && x.id == selectedChar.id).name));
            var views = temp.GetComponents <GenericView>();

            var chViews = temp.transform.GetComponentsInChildren <GenericView>();

            for (int i = 0, n = views.Length; i < n; i++)
            {
                views[i].Initialize();
            }
            for (int i = 0, n = chViews.Length; i < n; i++)
            {
                chViews[i].Initialize();
            }
        }
Exemple #2
0
 public CharacterInfo GetSelectedCharacter()
 {
     return(_characterSelection.GetSelectedCharacter());
 }