void Start() { positions = new List <Tile>(); GameObject grilla = GameObject.Find("Map").transform.Find("collision").gameObject; Transform[] celdas = grilla.transform.GetComponentsInChildren <Transform>(); for (int i = 1; i < celdas.Length; i++) { celdas[i].gameObject.AddComponent <TileScript>(); TileScript positionScript = celdas[i].gameObject.GetComponent <TileScript>(); positionScript.SetPosition(); Tile t = new Tile(positionScript.GetPosition(), positionScript.positionAux); positions.Add(t); } Debug.Log("Cant posiciones: " + positions.Count); }
public void CreateWarrior() { Warrior createdWarrior = new Warrior((int)sliders[0].value, (int)sliders[1].value, (int)sliders[2].value, (int)sliders[3].value, curPlayer); GameObject spawnedWarrior = Instantiate(warriorPrefab, (tile.transform.position + tile.GetPosition() + warriorStartPos), Quaternion.identity); spawnedWarrior.GetComponent <Actor>().SetWarrior(createdWarrior); tile.AddNewWarrior(spawnedWarrior.GetComponent <Actor>()); curPlayer.RemoveWarriorCost(warriorCost); curPlayer.AddWarrior(spawnedWarrior.GetComponent <Actor>()); panelContainer.SetActive(false); }