/// <summary> /// Spawn monster do hry dle jmena jeho typu /// </summary> public Monster SpawnMonster(string monsterTypeName, Vector3 position, bool isMinion, int level, int team = 0) { MonsterTemplate template = MonsterTemplateTable.Instance.GetType(monsterTypeName); if (template == null) { throw new NullReferenceException("cant find monstertemplate for " + monsterTypeName); } string name = template.GetFolderName(); GameObject go = Resources.Load("Prefabs/entity/" + name + "/" + name) as GameObject; if (go == null) { throw new NullReferenceException("Prefabs/entity/" + name + "/" + name); } GameObject result = Object.Instantiate(go, position, Quaternion.identity) as GameObject; EnemyData data = result.GetComponent <EnemyData>(); Monster m = RegisterNewCustomMonster(data, template, isMinion, level); if (team > 0) { m.Team = team; } return(m); }