This commit is contained in:
falc@null.net 2016-10-30 18:58:13 +01:00
parent db2748b12f
commit 9e27180ec2
2 changed files with 24 additions and 7 deletions

View file

@ -19,6 +19,7 @@ public class InputManagerScript : MonoBehaviour {
private bool showActions; private bool showActions;
private bool actionSelected; private bool actionSelected;
private bool selectTargetPos; private bool selectTargetPos;
private bool imageSelected;
private Image[] images; private Image[] images;
private int actualImage; private int actualImage;
private GameObject gosel; private GameObject gosel;
@ -42,6 +43,7 @@ public class InputManagerScript : MonoBehaviour {
gosel = null; gosel = null;
images = new Image[3]; images = new Image[3];
actualImage = 0; actualImage = 0;
imageSelected = false;
} }
// Update is called once per frame // Update is called once per frame
@ -89,16 +91,19 @@ public class InputManagerScript : MonoBehaviour {
gosel = c; gosel = c;
unitSelected = true; unitSelected = true;
showActions = true; showActions = true;
actualImage = 0;
actionOption = 0;
GameObject canv = GameObject.Find ("Canvas"); GameObject canv = GameObject.Find ("Canvas");
images [0] = Instantiate (imageAttack); images [0] = Instantiate (imageAttack);
images[0].transform.SetParent (canv.transform, false); images[0].transform.SetParent (canv.transform, false);
images [0].transform.position = new Vector3 (50, 0, 50); images [0].transform.position = new Vector3 (50, 0, 100);
images[0].color = new Color (1f, 0f, 0f);
images[1] = Instantiate (imageMove); images[1] = Instantiate (imageMove);
images[1].transform.SetParent (canv.transform, false); images[1].transform.SetParent (canv.transform, false);
images [1].transform.position = new Vector3 (100, 0, 50); images [1].transform.position = new Vector3 (150, 0, 100);
images[2] = Instantiate (imageEndTurn); images[2] = Instantiate (imageEndTurn);
images[2].transform.SetParent (canv.transform, false); images[2].transform.SetParent (canv.transform, false);
images [2].transform.position = new Vector3 (150, 0, 50); images [2].transform.position = new Vector3 (250, 0, 100);
} else { } else {
changeCursorColor (Color.red); changeCursorColor (Color.red);
@ -113,7 +118,7 @@ public class InputManagerScript : MonoBehaviour {
changeCursorColor (Color.cyan); changeCursorColor (Color.cyan);
} }
if (Input.GetKeyUp (KeyCode.Space) && !selectTargetPos) { if (Input.GetKeyUp (KeyCode.Space) ) {
Vector3 tpos = cursor.transform.position; Vector3 tpos = cursor.transform.position;
switch (actionOption) { switch (actionOption) {
case 0: case 0:
@ -128,13 +133,16 @@ public class InputManagerScript : MonoBehaviour {
changeCursorColor (Color.red); changeCursorColor (Color.red);
} }
break; break;
case 2:
tmss.changeTeam ();
break;
default: default:
break; break;
} }
actionSelected = false; actionSelected = false;
gosel = null; gosel = null;
actionOption = -1; actionOption = 0;
selectTargetPos = false; selectTargetPos = false;
@ -149,8 +157,10 @@ public class InputManagerScript : MonoBehaviour {
images[actualImage].color = new Color (1f, 0f, 0f); images[actualImage].color = new Color (1f, 0f, 0f);
images[previousImage].color = new Color (1f, 1f, 1f); images[previousImage].color = new Color (1f, 1f, 1f);
actionOption = actualImage; actionOption = actualImage;
} }
} }
if (Input.GetKeyUp (KeyCode.A)) { if (Input.GetKeyUp (KeyCode.A)) {
int previousImage = actualImage; int previousImage = actualImage;
if (actualImage > 0) { if (actualImage > 0) {
@ -161,7 +171,8 @@ public class InputManagerScript : MonoBehaviour {
} }
} }
if (Input.GetKeyUp (KeyCode.Space) && actionOption > -1) {
if (Input.GetKeyUp (KeyCode.Space) && actionOption != -1) {
selectTargetPos = false; selectTargetPos = false;
actionSelected = true; actionSelected = true;
unitSelected = false; unitSelected = false;

View file

@ -108,12 +108,18 @@ public class TurnManagerScript : MonoBehaviour {
} }
} }
void changeTeam (int newTeam) { public void changeTeam (int newTeam) {
actualPlayer = newTeam; actualPlayer = newTeam;
actualNumChars = unitList [actualPlayer].Count; actualNumChars = unitList [actualPlayer].Count;
actualNumFinishedChars = 0; actualNumFinishedChars = 0;
} }
public void changeTeam () {
actualPlayer = (actualPlayer+1) % playerNum;
actualNumChars = unitList [actualPlayer].Count;
actualNumFinishedChars = 0;
}
public GameObject getUnitAtTile(int i, int j) { public GameObject getUnitAtTile(int i, int j) {
return unitMap [i, j]; return unitMap [i, j];
} }