public static GameObject CreateClientFruiton(int id, GameObject parent) { FruitonDatabase fruitonDatabase = GameManager.Instance.FruitonDatabase; Fruiton kernelFruiton = FruitonFactory.makeFruiton(id, fruitonDatabase); var newFruitonObject = UnityEngine.Object.Instantiate(Resources.Load("Models/Battle/BoyFighter", typeof(GameObject))) as GameObject; newFruitonObject.GetComponentInChildren <SkeletonAnimation>().skeleton.SetSkin(kernelFruiton.model); newFruitonObject.AddComponent <ClientFruiton>().KernelFruiton = kernelFruiton; newFruitonObject.transform.parent = parent.transform; return(newFruitonObject); }
public static IEnumerable <Fruiton> CreateAllKernelFruitons() { FruitonDatabase fruitonDatabase = GameManager.Instance.FruitonDatabase; var result = new List <Fruiton>(); foreach (int key in fruitonDatabase.fruitonDb._keys) { // This check is here because Haxe IntMap may also contain invalid key-value pairs, which can be recognised by the fact that their key is 0. if (key == 0) { continue; } result.Add(FruitonFactory.makeFruiton(key, fruitonDatabase)); } return(result); }
/// <summary> /// Loads last saved player's data from local cache and server, sets up fruiton database. /// </summary> private void Initialize() { FruitonDatabase = new FruitonDatabase(KernelUtils.LoadTextResource(FRUITON_DB_FILE)); AllFruitons = ClientFruitonFactory.CreateAllKernelFruitons(); if (IsInTrial) { AvailableFruitons = AllPlayableFruitons.Select(fruiton => fruiton.dbId).ToList(); FruitonTeamList = new FruitonTeamList(); loggedPlayerInfo = new LoggedPlayerInfo(); } else { PlayerOptions = Serializer.LoadPlayerSettings(); Serializer.DeserializeFruitonTeams(); AvailableFruitons = Serializer.LoadAvailableFruitons(); } if (IsOnline) { PlayerHelper.GetAllFruitonTeams(MergeTeamLists, Debug.Log); PlayerHelper.GetAvailableFruitons((list) => Debug.Log("Available fruitons loaded from server."), Debug.Log); } }