Added real time cursor coloring functionality, and dead unit removal.
This commit is contained in:
parent
ed9bb82606
commit
769ad502b9
6 changed files with 283 additions and 163 deletions
|
@ -4,6 +4,14 @@ using UnityEngine.UI;
|
||||||
|
|
||||||
public class InputManagerScript : MonoBehaviour {
|
public class InputManagerScript : MonoBehaviour {
|
||||||
|
|
||||||
|
public enum MyColor {
|
||||||
|
red,
|
||||||
|
green,
|
||||||
|
blue,
|
||||||
|
yellow,
|
||||||
|
cyan
|
||||||
|
}
|
||||||
|
|
||||||
private GameObject cursor;
|
private GameObject cursor;
|
||||||
public Image imageMove;
|
public Image imageMove;
|
||||||
public Image imageAttack;
|
public Image imageAttack;
|
||||||
|
@ -14,192 +22,273 @@ public class InputManagerScript : MonoBehaviour {
|
||||||
private float timeExpStep;
|
private float timeExpStep;
|
||||||
private float timeExpLimit;
|
private float timeExpLimit;
|
||||||
|
|
||||||
|
private bool unitMenu;
|
||||||
private bool unitSelected;
|
private bool openMenu;
|
||||||
private bool showActions;
|
private bool unitActionSelected;
|
||||||
private bool actionSelected;
|
private bool generalActionSelected;
|
||||||
private bool selectTargetPos;
|
|
||||||
private bool imageSelected;
|
private bool imageSelected;
|
||||||
private Image[] images;
|
private Image[] menuOptions;
|
||||||
private int actualImage;
|
private int currentMenuOption;
|
||||||
private GameObject gosel;
|
private GameObject selectedGO;
|
||||||
|
|
||||||
private int actionOption;
|
private int actionOption;
|
||||||
|
|
||||||
private TurnManagerScript tmss;
|
private Color menuCursorColor = new Color (1f, 1f, 0f);
|
||||||
|
private MyColor currentCursorColor = MyColor.cyan;
|
||||||
|
|
||||||
|
private TurnManagerScript tms;
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
cursor = GameObject.Find ("Cursor");
|
cursor = GameObject.Find ("Cursor");
|
||||||
//cursor.transform.Rotate (new Vector3(90, 0, 0));
|
//cursor.transform.Rotate (new Vector3(90, 0, 0));
|
||||||
|
|
||||||
unitSelected = false;
|
unitMenu = false;
|
||||||
showActions = false;
|
openMenu = false;
|
||||||
actionOption = -1;
|
actionOption = -1;
|
||||||
actionSelected = false;
|
unitActionSelected = false;
|
||||||
selectTargetPos = false;
|
generalActionSelected = false;
|
||||||
gosel = null;
|
selectedGO = null;
|
||||||
images = new Image[3];
|
currentMenuOption = 0;
|
||||||
actualImage = 0;
|
|
||||||
imageSelected = false;
|
imageSelected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update () {
|
void Update () {
|
||||||
|
|
||||||
if (!showActions) {
|
if (!openMenu)
|
||||||
if (Input.GetKeyDown (KeyCode.A)) {
|
moveCursor ();
|
||||||
cursor.transform.Translate (-1f, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Input.GetKeyDown (KeyCode.D)) {
|
else if (openMenu)
|
||||||
cursor.transform.Translate (1f, 0, 0);
|
moveMenuCursor ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetKeyDown (KeyCode.W)) {
|
|
||||||
cursor.transform.Translate (0, 1f, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Input.GetKeyDown (KeyCode.S)) {
|
|
||||||
cursor.transform.Translate (0, -1f, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (showActions) {
|
|
||||||
if (Input.GetKey (KeyCode.Escape)) {
|
|
||||||
showActions = false;
|
|
||||||
unitSelected = false;
|
|
||||||
for (int i = 0; i < images.Length; i++) {
|
|
||||||
DestroyObject (images [i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
void moveMenuCursor() {
|
||||||
|
if (Input.GetKeyDown (KeyCode.Escape)) {
|
||||||
|
openMenu = false;
|
||||||
|
unitMenu = false;
|
||||||
|
for (int i = 0; i < menuOptions.Length; i++) {
|
||||||
|
DestroyObject (menuOptions [i]);
|
||||||
}
|
}
|
||||||
|
actionOption = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (Input.GetKeyDown (KeyCode.D) && menuOptions.Length > 1) {
|
||||||
|
int previousOption = currentMenuOption;
|
||||||
|
currentMenuOption = (currentMenuOption+1) % menuOptions.Length;
|
||||||
|
menuOptions[currentMenuOption].color = menuCursorColor;
|
||||||
|
menuOptions[previousOption].color = new Color (1f, 1f, 1f);
|
||||||
|
}
|
||||||
|
|
||||||
if (Input.GetKeyUp(KeyCode.Space) && !unitSelected && !actionSelected) {
|
else if (Input.GetKeyDown (KeyCode.A) && menuOptions.Length > 1) {
|
||||||
Vector3 tilePosition = cursor.transform.position;
|
int previousOption = currentMenuOption;
|
||||||
int ipos = (int)tilePosition.z;
|
currentMenuOption -= 1;
|
||||||
int jpos = (int)tilePosition.x;
|
if (currentMenuOption < 0)
|
||||||
GameObject c = tmss.getUnitAtTile(ipos, jpos);
|
currentMenuOption = menuOptions.Length - 1;
|
||||||
|
menuOptions[currentMenuOption].color = menuCursorColor;
|
||||||
|
menuOptions[previousOption].color = new Color (1f, 1f, 1f);
|
||||||
|
}
|
||||||
|
|
||||||
if (c != null) {
|
else if (Input.GetKeyDown (KeyCode.Space)) {
|
||||||
UnitBehaviour ub = c.GetComponent<UnitBehaviour> ();
|
actionOption = currentMenuOption;
|
||||||
UnitBehaviour.Team mahteam = (UnitBehaviour.Team) tmss.actualPlayer+1;
|
|
||||||
if (ub.teamID == mahteam && ub.remainingActions != 0) {
|
if (unitMenu) {
|
||||||
gosel = c;
|
unitMenu = false;
|
||||||
unitSelected = true;
|
unitActionSelected = true;
|
||||||
showActions = true;
|
changeCursorColor(MyColor.green);
|
||||||
actualImage = 0;
|
} else {
|
||||||
|
if (actionOption == 0) {
|
||||||
|
endTurn ();
|
||||||
actionOption = -1;
|
actionOption = -1;
|
||||||
GameObject canv = GameObject.Find ("Canvas");
|
changeCursorColor (MyColor.cyan);
|
||||||
images [0] = Instantiate (imageAttack);
|
|
||||||
images[0].transform.SetParent (canv.transform, false);
|
|
||||||
images [0].transform.position = new Vector3 (50, 0, 100);
|
|
||||||
images[0].color = new Color (1f, 0f, 0f);
|
|
||||||
images[1] = Instantiate (imageMove);
|
|
||||||
images[1].transform.SetParent (canv.transform, false);
|
|
||||||
images [1].transform.position = new Vector3 (150, 0, 100);
|
|
||||||
images[2] = Instantiate (imageEndTurn);
|
|
||||||
images[2].transform.SetParent (canv.transform, false);
|
|
||||||
images [2].transform.position = new Vector3 (250, 0, 100);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
changeCursorColor (Color.red);
|
generalActionSelected = true;
|
||||||
|
changeCursorColor(MyColor.green);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
openMenu = false;
|
||||||
|
for (int i = 0; i < menuOptions.Length; i++) {
|
||||||
|
DestroyObject (menuOptions [i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void moveCursor() {
|
||||||
|
if (Input.GetKeyDown (KeyCode.A)) {
|
||||||
|
cursor.transform.Translate (-1f, 0, 0);
|
||||||
|
updateCursorColor ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actionSelected) {
|
if (Input.GetKeyDown (KeyCode.D)) {
|
||||||
if (Input.GetKeyUp (KeyCode.Escape)) {
|
cursor.transform.Translate (1f, 0, 0);
|
||||||
actionSelected = false;
|
updateCursorColor ();
|
||||||
changeCursorColor (Color.cyan);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (Input.GetKeyUp (KeyCode.Space) ) {
|
if (Input.GetKeyDown (KeyCode.W)) {
|
||||||
|
cursor.transform.Translate (0, 1f, 0);
|
||||||
|
updateCursorColor ();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Input.GetKeyDown (KeyCode.S)) {
|
||||||
|
cursor.transform.Translate (0, -1f, 0);
|
||||||
|
updateCursorColor ();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Input.GetKeyDown (KeyCode.Escape)) {
|
||||||
|
if (unitActionSelected) {
|
||||||
|
unitActionSelected = false;
|
||||||
|
changeCursorColor (MyColor.cyan);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Input.GetKeyDown (KeyCode.Space)) {
|
||||||
|
if (!unitMenu && !unitActionSelected && !generalActionSelected)
|
||||||
|
openMenuOnSelection ();
|
||||||
|
|
||||||
|
else if (unitActionSelected) {
|
||||||
Vector3 tpos = cursor.transform.position;
|
Vector3 tpos = cursor.transform.position;
|
||||||
switch (actionOption) {
|
switch (actionOption) {
|
||||||
case 0:
|
case 0:
|
||||||
if (tmss.canAttackTo (gosel, (int)tpos.z, (int)tpos.x)) {
|
if (tms.canAttackTo (selectedGO, (int)tpos.z, (int)tpos.x)) {
|
||||||
tmss.attackTo (gosel, (int)tpos.z, (int)tpos.x);
|
tms.attackTo (selectedGO, (int)tpos.z, (int)tpos.x);
|
||||||
changeCursorColor (Color.cyan);
|
changeCursorColor (MyColor.cyan);
|
||||||
} else {
|
} else {
|
||||||
changeCursorColor (Color.red);
|
changeCursorColor (MyColor.red);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (tmss.canMoveTo (gosel, (int)tpos.z, (int)tpos.x)) {
|
if (tms.canMoveTo (selectedGO, (int)tpos.z, (int)tpos.x)) {
|
||||||
tmss.moveTo (gosel, (int)tpos.z, (int)tpos.x);
|
tms.moveTo (selectedGO, (int)tpos.z, (int)tpos.x);
|
||||||
changeCursorColor (Color.cyan);
|
changeCursorColor (MyColor.cyan);
|
||||||
} else {
|
} else {
|
||||||
changeCursorColor (Color.red);
|
changeCursorColor (MyColor.red);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
|
||||||
tmss.changeTeam ();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
actionSelected = false;
|
unitActionSelected = false;
|
||||||
gosel = null;
|
selectedGO = null;
|
||||||
actionOption = -1;
|
actionOption = -1;
|
||||||
selectTargetPos = false;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unitSelected) {
|
|
||||||
if (Input.GetKeyUp (KeyCode.D)) {
|
|
||||||
int previousImage = actualImage;
|
|
||||||
if (actualImage < 2) {
|
|
||||||
actualImage += 1;
|
|
||||||
images[actualImage].color = new Color (1f, 0f, 0f);
|
|
||||||
images[previousImage].color = new Color (1f, 1f, 1f);
|
|
||||||
actionOption = actualImage;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Input.GetKeyUp (KeyCode.A)) {
|
|
||||||
int previousImage = actualImage;
|
|
||||||
if (actualImage > 0) {
|
|
||||||
actualImage -= 1;
|
|
||||||
images[actualImage].color = new Color (1f, 0f, 0f);
|
|
||||||
images[previousImage].color = new Color (1f, 1f, 1f);
|
|
||||||
actionOption = actualImage;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (Input.GetKeyUp (KeyCode.Space) && actionOption > -1) {
|
|
||||||
selectTargetPos = false;
|
|
||||||
actionSelected = true;
|
|
||||||
unitSelected = false;
|
|
||||||
showActions = false;
|
|
||||||
for (int i = 0; i < images.Length; i++) {
|
|
||||||
DestroyObject (images [i]);
|
|
||||||
}
|
|
||||||
changeCursorColor(new Color(1,1,0));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTurnMan(TurnManagerScript tms) {
|
void updateCursorColor() {
|
||||||
tmss = tms;
|
if (!unitActionSelected && currentCursorColor != MyColor.cyan)
|
||||||
|
changeCursorColor (MyColor.cyan);
|
||||||
|
|
||||||
|
else if (unitActionSelected) {
|
||||||
|
Vector3 pos = cursor.transform.position;
|
||||||
|
|
||||||
|
if (actionOption == 0) {
|
||||||
|
if (tms.canAttackTo (selectedGO, (int)pos.z, (int)pos.x))
|
||||||
|
changeCursorColor (MyColor.green);
|
||||||
|
else
|
||||||
|
changeCursorColor (MyColor.yellow);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(actionOption == 1) {
|
||||||
|
if (tms.canMoveTo (selectedGO, (int)pos.z, (int)pos.x))
|
||||||
|
changeCursorColor (MyColor.green);
|
||||||
|
else
|
||||||
|
changeCursorColor (MyColor.yellow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void openMenuOnSelection () {
|
||||||
|
Vector3 tilePosition = cursor.transform.position;
|
||||||
|
int x = (int)tilePosition.z;
|
||||||
|
int y = (int)tilePosition.x;
|
||||||
|
selectedGO = tms.getUnitAtTile(x, y);
|
||||||
|
|
||||||
|
if (selectedGO != null) {
|
||||||
|
UnitBehaviour ub = selectedGO.GetComponent<UnitBehaviour> ();
|
||||||
|
UnitBehaviour.Team myTeam = (UnitBehaviour.Team) tms.currentPlayer;
|
||||||
|
if (ub.teamID == myTeam) {
|
||||||
|
if (ub.remainingActions != 0)
|
||||||
|
loadUnitMenu ();
|
||||||
|
else
|
||||||
|
changeCursorColor (MyColor.red);
|
||||||
|
} else
|
||||||
|
changeCursorColor (MyColor.red);
|
||||||
|
} else {
|
||||||
|
loadGeneralMenu ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadUnitMenu() {
|
||||||
|
openMenu = true;
|
||||||
|
menuOptions = new Image[2];
|
||||||
|
unitMenu = true;
|
||||||
|
currentMenuOption = 0;
|
||||||
|
actionOption = 0;
|
||||||
|
|
||||||
|
GameObject canv = GameObject.Find ("Canvas");
|
||||||
|
|
||||||
|
menuOptions [0] = Instantiate (imageAttack);
|
||||||
|
menuOptions[0].transform.SetParent (canv.transform, false);
|
||||||
|
menuOptions [0].transform.position = new Vector3 (50, 0, 100);
|
||||||
|
menuOptions[0].color = menuCursorColor;
|
||||||
|
menuOptions[1] = Instantiate (imageMove);
|
||||||
|
menuOptions[1].transform.SetParent (canv.transform, false);
|
||||||
|
menuOptions [1].transform.position = new Vector3 (150, 0, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadGeneralMenu() {
|
||||||
|
openMenu = true;
|
||||||
|
menuOptions = new Image[1];
|
||||||
|
currentMenuOption = 0;
|
||||||
|
actionOption = 0;
|
||||||
|
|
||||||
|
GameObject canv = GameObject.Find ("Canvas");
|
||||||
|
|
||||||
|
menuOptions[0] = Instantiate (imageEndTurn);
|
||||||
|
menuOptions[0].transform.SetParent (canv.transform, false);
|
||||||
|
menuOptions [0].transform.position = new Vector3 (50, 0, 100);
|
||||||
|
menuOptions[0].color = menuCursorColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeCursorColor(Color c) {
|
private void changeCursorColor(Color c) {
|
||||||
Light li = cursor.GetComponent<Light> () as Light;
|
Light li = cursor.GetComponent<Light> () as Light;
|
||||||
li.color = c;
|
li.color = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void changeCursorColor(MyColor cc) {
|
||||||
|
Color c;
|
||||||
|
|
||||||
|
switch (cc) {
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
case MyColor.red:
|
||||||
|
c = Color.red;
|
||||||
|
break;
|
||||||
|
case MyColor.green:
|
||||||
|
c = Color.green;
|
||||||
|
break;
|
||||||
|
case MyColor.blue:
|
||||||
|
c = Color.blue;
|
||||||
|
break;
|
||||||
|
case MyColor.yellow:
|
||||||
|
c = new Color (1, 1, 0);
|
||||||
|
break;
|
||||||
|
case MyColor.cyan:
|
||||||
|
c = Color.cyan;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
currentCursorColor = cc;
|
||||||
|
|
||||||
|
Light li = cursor.GetComponent<Light> () as Light;
|
||||||
|
li.color = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTurnMan(TurnManagerScript s) {
|
||||||
|
tms = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
void endTurn() {
|
||||||
|
tms.changeTeam ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,17 +30,17 @@ public class TurnManagerScript : MonoBehaviour {
|
||||||
public GameObject[,] unitMap;
|
public GameObject[,] unitMap;
|
||||||
public Vector2 mapSize;
|
public Vector2 mapSize;
|
||||||
|
|
||||||
public int actualPlayer;
|
public int currentPlayer;
|
||||||
private int actualNumChars;
|
private int currentNumChars;
|
||||||
private int actualNumFinishedChars = 0;
|
private int currentNumFinishedChars = 0;
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
|
|
||||||
//Estamos en turno
|
//Estamos en turno
|
||||||
inTurn = true;
|
inTurn = true;
|
||||||
actualPlayer = 0;
|
currentPlayer = 0;
|
||||||
actualNumChars = unitList [actualPlayer].Count;
|
currentNumChars = unitList [currentPlayer].Count;
|
||||||
// Characters that have finished its actions
|
// Characters that have finished its actions
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ public class TurnManagerScript : MonoBehaviour {
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update () {
|
void Update () {
|
||||||
|
|
||||||
if (actualNumFinishedChars == actualNumChars) {
|
if (currentNumFinishedChars == currentNumChars) {
|
||||||
changeTeam ((actualPlayer + 1) % playerNum);
|
changeTeam ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,11 +60,6 @@ public class TurnManagerScript : MonoBehaviour {
|
||||||
act (c);
|
act (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void attackRange (int i, int j, int k, int l, params int[] altParams ) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool canMoveTo(GameObject go, int i, int j) {
|
public bool canMoveTo(GameObject go, int i, int j) {
|
||||||
UnitBehaviour ub = go.GetComponent<UnitBehaviour> ();
|
UnitBehaviour ub = go.GetComponent<UnitBehaviour> ();
|
||||||
int ra = ub.remainingActions;
|
int ra = ub.remainingActions;
|
||||||
|
@ -87,7 +82,7 @@ public class TurnManagerScript : MonoBehaviour {
|
||||||
//TODO: MOVEMENT
|
//TODO: MOVEMENT
|
||||||
|
|
||||||
if (ub.remainingActions == 0)
|
if (ub.remainingActions == 0)
|
||||||
actualNumFinishedChars += 1;
|
currentNumFinishedChars += 1;
|
||||||
//Move the unit
|
//Move the unit
|
||||||
go.transform.position = new Vector3 (j, 0, i);
|
go.transform.position = new Vector3 (j, 0, i);
|
||||||
//Update matrices
|
//Update matrices
|
||||||
|
@ -149,23 +144,26 @@ public class TurnManagerScript : MonoBehaviour {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeTeam (int newTeam) {
|
public void changeTeam () {
|
||||||
int previousTeam = actualPlayer;
|
int previousTeam = currentPlayer;
|
||||||
|
currentPlayer = (currentPlayer + 1) % (playerNum + 1);
|
||||||
|
|
||||||
for (int i = 0; i < unitList [previousTeam].Count; i++) {
|
for (int i = 0; i < unitList [previousTeam].Count; i++) {
|
||||||
GameObject go = unitList [previousTeam][i];
|
GameObject go = unitList [previousTeam][i];
|
||||||
UnitBehaviour ub = go.GetComponent<UnitBehaviour> ();
|
if (go != null) {
|
||||||
ub.remainingActions = ub.actionsPerTurn;
|
UnitBehaviour ub = go.GetComponent<UnitBehaviour> ();
|
||||||
|
ub.remainingActions = ub.actionsPerTurn;
|
||||||
|
} else {
|
||||||
|
unitList [previousTeam].RemoveAt (i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
actualPlayer = newTeam;
|
if (currentPlayer == 0)
|
||||||
actualNumChars = unitList [actualPlayer].Count;
|
turnNum++;
|
||||||
actualNumFinishedChars = 0;
|
currentNumChars = unitList [currentPlayer].Count;
|
||||||
}
|
currentNumFinishedChars = 0;
|
||||||
|
Debug.Log ("switched to team " + currentPlayer);
|
||||||
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) {
|
||||||
|
|
|
@ -45,7 +45,6 @@ public class UnitBehaviour : MonoBehaviour {
|
||||||
bool damageAnim = false;
|
bool damageAnim = false;
|
||||||
bool dodgeAnim = false;
|
bool dodgeAnim = false;
|
||||||
bool idleAnim = false;
|
bool idleAnim = false;
|
||||||
float deathTimer = 0;
|
|
||||||
|
|
||||||
public Animator anim;
|
public Animator anim;
|
||||||
|
|
||||||
|
@ -158,14 +157,12 @@ public class UnitBehaviour : MonoBehaviour {
|
||||||
attackAnim = false;
|
attackAnim = false;
|
||||||
} else if (deathAnim) {
|
} else if (deathAnim) {
|
||||||
anim.Play ("death", -1, 0f);
|
anim.Play ("death", -1, 0f);
|
||||||
deathTimer = Time.time;
|
|
||||||
deathAnim = false;
|
deathAnim = false;
|
||||||
if(idleAnim) idleAnim = false;
|
if(idleAnim) idleAnim = false;
|
||||||
|
Die (1.5f);
|
||||||
} else if (moveAnim) {
|
} else if (moveAnim) {
|
||||||
anim.Play ("move", -1, 0f);
|
anim.Play ("move", -1, 0f);
|
||||||
moveAnim = false;
|
moveAnim = false;
|
||||||
} else if (deathTimer > 0 && Time.time - deathTimer > 1.5) {
|
|
||||||
Die ();
|
|
||||||
} else if (idleAnim) {
|
} else if (idleAnim) {
|
||||||
anim.Play ("idle", -1, 0f);
|
anim.Play ("idle", -1, 0f);
|
||||||
idleAnim = false;
|
idleAnim = false;
|
||||||
|
@ -175,4 +172,8 @@ public class UnitBehaviour : MonoBehaviour {
|
||||||
public void Die () {
|
public void Die () {
|
||||||
Destroy (gameObject);
|
Destroy (gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Die (float t) {
|
||||||
|
Destroy (gameObject, t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,6 +168,7 @@ public class UnitCreator : MonoBehaviour {
|
||||||
createUnit (16, 24, UnitBehaviour.Team.Enemy1);
|
createUnit (16, 24, UnitBehaviour.Team.Enemy1);
|
||||||
createUnit (17, 26, UnitBehaviour.Team.Enemy1, UnitType.Archer);
|
createUnit (17, 26, UnitBehaviour.Team.Enemy1, UnitType.Archer);
|
||||||
|
|
||||||
|
unitsByTeam.Add (teamNone);
|
||||||
unitsByTeam.Add (teamPlayer);
|
unitsByTeam.Add (teamPlayer);
|
||||||
unitsByTeam.Add (teamEnemy1);
|
unitsByTeam.Add (teamEnemy1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,7 @@ PlayerSettings:
|
||||||
iPhoneTargetOSVersion: 24
|
iPhoneTargetOSVersion: 24
|
||||||
tvOSSdkVersion: 0
|
tvOSSdkVersion: 0
|
||||||
tvOSTargetOSVersion: 900
|
tvOSTargetOSVersion: 900
|
||||||
|
tvOSRequireExtendedGameController: 0
|
||||||
uIPrerenderedIcon: 0
|
uIPrerenderedIcon: 0
|
||||||
uIRequiresPersistentWiFi: 0
|
uIRequiresPersistentWiFi: 0
|
||||||
uIRequiresFullScreen: 1
|
uIRequiresFullScreen: 1
|
||||||
|
@ -162,6 +163,7 @@ PlayerSettings:
|
||||||
iOSLaunchScreeniPadCustomXibPath:
|
iOSLaunchScreeniPadCustomXibPath:
|
||||||
iOSDeviceRequirements: []
|
iOSDeviceRequirements: []
|
||||||
iOSURLSchemes: []
|
iOSURLSchemes: []
|
||||||
|
appleDeveloperTeamID:
|
||||||
AndroidTargetDevice: 0
|
AndroidTargetDevice: 0
|
||||||
AndroidSplashScreenScale: 0
|
AndroidSplashScreenScale: 0
|
||||||
androidSplashScreen: {fileID: 0}
|
androidSplashScreen: {fileID: 0}
|
||||||
|
@ -197,12 +199,15 @@ PlayerSettings:
|
||||||
wiiUSystemHeapSize: 128
|
wiiUSystemHeapSize: 128
|
||||||
wiiUTVStartupScreen: {fileID: 0}
|
wiiUTVStartupScreen: {fileID: 0}
|
||||||
wiiUGamePadStartupScreen: {fileID: 0}
|
wiiUGamePadStartupScreen: {fileID: 0}
|
||||||
|
wiiUDrcBufferDisabled: 0
|
||||||
wiiUProfilerLibPath:
|
wiiUProfilerLibPath:
|
||||||
actionOnDotNetUnhandledException: 1
|
actionOnDotNetUnhandledException: 1
|
||||||
enableInternalProfiler: 0
|
enableInternalProfiler: 0
|
||||||
logObjCUncaughtExceptions: 1
|
logObjCUncaughtExceptions: 1
|
||||||
enableCrashReportAPI: 0
|
enableCrashReportAPI: 0
|
||||||
|
cameraUsageDescription:
|
||||||
locationUsageDescription:
|
locationUsageDescription:
|
||||||
|
microphoneUsageDescription:
|
||||||
XboxTitleId:
|
XboxTitleId:
|
||||||
XboxImageXexPath:
|
XboxImageXexPath:
|
||||||
XboxSpaPath:
|
XboxSpaPath:
|
||||||
|
@ -242,7 +247,8 @@ PlayerSettings:
|
||||||
ps4AppType: 0
|
ps4AppType: 0
|
||||||
ps4ParamSfxPath:
|
ps4ParamSfxPath:
|
||||||
ps4VideoOutPixelFormat: 0
|
ps4VideoOutPixelFormat: 0
|
||||||
ps4VideoOutResolution: 4
|
ps4VideoOutInitialWidth: 1920
|
||||||
|
ps4VideoOutReprojectionRate: 120
|
||||||
ps4PronunciationXMLPath:
|
ps4PronunciationXMLPath:
|
||||||
ps4PronunciationSIGPath:
|
ps4PronunciationSIGPath:
|
||||||
ps4BackgroundImagePath:
|
ps4BackgroundImagePath:
|
||||||
|
@ -271,9 +277,12 @@ PlayerSettings:
|
||||||
ps4pnFriends: 1
|
ps4pnFriends: 1
|
||||||
ps4pnGameCustomData: 1
|
ps4pnGameCustomData: 1
|
||||||
playerPrefsSupport: 0
|
playerPrefsSupport: 0
|
||||||
|
ps4UseResolutionFallback: 0
|
||||||
|
restrictedAudioUsageRights: 0
|
||||||
ps4ReprojectionSupport: 0
|
ps4ReprojectionSupport: 0
|
||||||
ps4UseAudio3dBackend: 0
|
ps4UseAudio3dBackend: 0
|
||||||
ps4SocialScreenEnabled: 0
|
ps4SocialScreenEnabled: 0
|
||||||
|
ps4ScriptOptimizationLevel: 3
|
||||||
ps4Audio3dVirtualSpeakerCount: 14
|
ps4Audio3dVirtualSpeakerCount: 14
|
||||||
ps4attribCpuUsage: 0
|
ps4attribCpuUsage: 0
|
||||||
ps4PatchPkgPath:
|
ps4PatchPkgPath:
|
||||||
|
@ -407,12 +416,22 @@ PlayerSettings:
|
||||||
XboxOnePersistentLocalStorageSize: 0
|
XboxOnePersistentLocalStorageSize: 0
|
||||||
intPropertyNames:
|
intPropertyNames:
|
||||||
- Android::ScriptingBackend
|
- Android::ScriptingBackend
|
||||||
|
- Metro::ScriptingBackend
|
||||||
- Standalone::ScriptingBackend
|
- Standalone::ScriptingBackend
|
||||||
|
- WebGL::ScriptingBackend
|
||||||
|
- WebGL::audioCompressionFormat
|
||||||
|
- WebGL::exceptionSupport
|
||||||
|
- WebGL::memorySize
|
||||||
- WebPlayer::ScriptingBackend
|
- WebPlayer::ScriptingBackend
|
||||||
- iOS::Architecture
|
- iOS::Architecture
|
||||||
- iOS::ScriptingBackend
|
- iOS::ScriptingBackend
|
||||||
Android::ScriptingBackend: 0
|
Android::ScriptingBackend: 0
|
||||||
|
Metro::ScriptingBackend: 2
|
||||||
Standalone::ScriptingBackend: 0
|
Standalone::ScriptingBackend: 0
|
||||||
|
WebGL::ScriptingBackend: 1
|
||||||
|
WebGL::audioCompressionFormat: 4
|
||||||
|
WebGL::exceptionSupport: 1
|
||||||
|
WebGL::memorySize: 256
|
||||||
WebPlayer::ScriptingBackend: 0
|
WebPlayer::ScriptingBackend: 0
|
||||||
iOS::Architecture: 2
|
iOS::Architecture: 2
|
||||||
iOS::ScriptingBackend: 1
|
iOS::ScriptingBackend: 1
|
||||||
|
@ -428,6 +447,9 @@ PlayerSettings:
|
||||||
- Standalone::VR::enable
|
- Standalone::VR::enable
|
||||||
- Tizen::VR::enable
|
- Tizen::VR::enable
|
||||||
- WebGL::VR::enable
|
- WebGL::VR::enable
|
||||||
|
- WebGL::analyzeBuildSize
|
||||||
|
- WebGL::dataCaching
|
||||||
|
- WebGL::useEmbeddedResources
|
||||||
- WebPlayer::VR::enable
|
- WebPlayer::VR::enable
|
||||||
- WiiU::VR::enable
|
- WiiU::VR::enable
|
||||||
- Xbox360::VR::enable
|
- Xbox360::VR::enable
|
||||||
|
@ -446,6 +468,9 @@ PlayerSettings:
|
||||||
Standalone::VR::enable: 0
|
Standalone::VR::enable: 0
|
||||||
Tizen::VR::enable: 0
|
Tizen::VR::enable: 0
|
||||||
WebGL::VR::enable: 0
|
WebGL::VR::enable: 0
|
||||||
|
WebGL::analyzeBuildSize: 0
|
||||||
|
WebGL::dataCaching: 0
|
||||||
|
WebGL::useEmbeddedResources: 0
|
||||||
WebPlayer::VR::enable: 0
|
WebPlayer::VR::enable: 0
|
||||||
WiiU::VR::enable: 0
|
WiiU::VR::enable: 0
|
||||||
Xbox360::VR::enable: 0
|
Xbox360::VR::enable: 0
|
||||||
|
@ -463,6 +488,9 @@ PlayerSettings:
|
||||||
- Purchasing_ServiceEnabled::Purchasing_ServiceEnabled
|
- Purchasing_ServiceEnabled::Purchasing_ServiceEnabled
|
||||||
- UNet_ServiceEnabled::UNet_ServiceEnabled
|
- UNet_ServiceEnabled::UNet_ServiceEnabled
|
||||||
- Unity_Ads_ServiceEnabled::Unity_Ads_ServiceEnabled
|
- Unity_Ads_ServiceEnabled::Unity_Ads_ServiceEnabled
|
||||||
|
- WebGL::emscriptenArgs
|
||||||
|
- WebGL::template
|
||||||
|
- additionalIl2CppArgs::additionalIl2CppArgs
|
||||||
Analytics_ServiceEnabled::Analytics_ServiceEnabled: False
|
Analytics_ServiceEnabled::Analytics_ServiceEnabled: False
|
||||||
Build_ServiceEnabled::Build_ServiceEnabled: False
|
Build_ServiceEnabled::Build_ServiceEnabled: False
|
||||||
Collab_ServiceEnabled::Collab_ServiceEnabled: False
|
Collab_ServiceEnabled::Collab_ServiceEnabled: False
|
||||||
|
@ -472,6 +500,9 @@ PlayerSettings:
|
||||||
Purchasing_ServiceEnabled::Purchasing_ServiceEnabled: False
|
Purchasing_ServiceEnabled::Purchasing_ServiceEnabled: False
|
||||||
UNet_ServiceEnabled::UNet_ServiceEnabled: False
|
UNet_ServiceEnabled::UNet_ServiceEnabled: False
|
||||||
Unity_Ads_ServiceEnabled::Unity_Ads_ServiceEnabled: False
|
Unity_Ads_ServiceEnabled::Unity_Ads_ServiceEnabled: False
|
||||||
|
WebGL::emscriptenArgs:
|
||||||
|
WebGL::template: APPLICATION:Default
|
||||||
|
additionalIl2CppArgs::additionalIl2CppArgs:
|
||||||
vectorPropertyNames:
|
vectorPropertyNames:
|
||||||
- Android::VR::enabledDevices
|
- Android::VR::enabledDevices
|
||||||
- Metro::VR::enabledDevices
|
- Metro::VR::enabledDevices
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
m_EditorVersion: 5.4.1f1
|
m_EditorVersion: 5.4.2f2
|
||||||
m_StandardAssetsVersion: 0
|
m_StandardAssetsVersion: 0
|
||||||
|
|
Loading…
Reference in a new issue