public Character CreateCharacter(CharacterCreateData createData) { GameObject prefab = null; if (createData.team == Team.PLAYER1) { prefab = characterPrefab1; } else if (createData.team == Team.PLAYER2) { prefab = characterPrefab2; } var newCharacter = Instantiate(prefab, stoneRoot).GetComponent <Character>(); newCharacter.transform.position = new Vector3(createData.pos.x, stoneRoot.transform.position.y, createData.pos.z); newCharacter.transform.localScale = new Vector3(createData.data.sizeData.GetCharacterScale(), 0.1f, createData.data.sizeData.GetCharacterScale()); var findList = GameManager.Instance.ChracterList.FindAll(v => (int)v.Team == (int)createData.team); string name = createData.team.ToString() + "_" + findList.Count; newCharacter.name = name; newCharacter.Init(createData.data, createData.team); ChracterList.Add(newCharacter); if (createData.isPlayerChacter) { SetCurrentCharacter(newCharacter); } return(newCharacter); }
public Character AddCharacter(Team team, CharacterData data, Vector3 pos, bool isPlayerChacter) { var newData = new CharacterCreateData(team, data, pos, isPlayerChacter); TestCharacterCreateDataList.Add(newData); return(CreateCharacter(newData)); }