This commit is contained in:
falc@null.net 2016-10-29 10:54:28 +02:00
parent 26b2fb2f93
commit e15dbc9182
2 changed files with 13 additions and 10 deletions

View file

@ -37,7 +37,7 @@ public class Generator : MonoBehaviour {
map [10, 20] = -1;
mScript.setMatrix (map,x,y);
turnMan.GetComponent<TurnManagerScript> ().charMap = uScript.tutorialUnits ();
turnMan.GetComponent<TurnManagerScript> ().charMap = uScript.tutorialUnits (x, y);
}
// Update is called once per frame

View file

@ -19,13 +19,9 @@ public class UnitCreator : MonoBehaviour {
// Use this for initialization
void Start () {
units = new List<GameObject>((int)(mapSize.y*mapSize.x));
playerLichScript = null;
for (int i = 0; i < mapSize.y; i++) {
for (int j = 0; j < mapSize.x; j++) {
units.Insert(i * (int) mapSize.x + j, null);
}
}
}
// Update is called once per frame
@ -41,7 +37,7 @@ public class UnitCreator : MonoBehaviour {
unit.transform.localScale = new Vector3 (unit.transform.lossyScale.y/unit.transform.lossyScale.y, 1, unit.transform.lossyScale.z/unit.transform.lossyScale.y);
unit.GetComponent<UnitBehaviour> ().SetupStats (posX, posZ, 3, 3, 100, 0, 0, 0);
unit.GetComponent<UnitBehaviour> ().SetupBaseAttack (4, 2, 3);
units.Insert(posX*(int)mapSize.x*posZ, unit);
units.Insert(posX*(int)mapSize.x+posZ, unit);
if (team == UnitBehaviour.Team.Player && playerLichScript == null )
playerLichScript = unit.GetComponent<UnitBehaviour> ();
@ -50,7 +46,7 @@ public class UnitCreator : MonoBehaviour {
unit = Instantiate (skeletonObject, new Vector3(posX, 0f, posZ), Quaternion.identity) as GameObject;
unit.transform.localScale = new Vector3 (unit.transform.localScale.x*0.3f, unit.transform.localScale.y*0.3f, unit.transform.localScale.z*0.3f);
unit.GetComponent<UnitBehaviour> ().SetupStats (posX, posZ);
units.Insert(posX*(int)mapSize.x*posZ, unit);
units.Insert(posX*(int)mapSize.x+posZ, unit);
if (team == UnitBehaviour.Team.Enemy1) {
@ -63,7 +59,14 @@ public class UnitCreator : MonoBehaviour {
}
public List<GameObject> tutorialUnits() {
public List<GameObject> tutorialUnits(int x, int y) {
units = new List<GameObject>(x * y);
for (int i = 0; i < y; i++) {
for (int j = 0; j < x; j++) {
units.Insert(i * x + j, null);
}
}
createUnit (9, 5, UnitBehaviour.Team.Player, UnitType.Lich);
createUnit (8, 7, UnitBehaviour.Team.Player);