vylion the master

This commit is contained in:
falc@null.net 2016-10-29 11:50:39 +02:00
parent e15dbc9182
commit 04a26c89c3
2 changed files with 27 additions and 7 deletions

View file

@ -27,6 +27,10 @@ public class TurnManagerScript : MonoBehaviour {
private float timeExpStep;
private float timeExpLimit;
private bool unitSelected;
private bool showActions;
// Use this for initialization
void Start () {
@ -37,14 +41,16 @@ public class TurnManagerScript : MonoBehaviour {
// Characters that have finished its actions
actualNumFinishedChars = 0;
timeStep = 0.4f;
timeStep = 0.2f;
timeExp = 0.0f;
timeExpStep = 0.04f;
timeExpLimit = 0.3f;
timeExpStep = 0.05f;
timeExpLimit = 0.15f;
cursor = Instantiate (cursor, new Vector3 (1.0f, 1.5f, 1.0f), Quaternion.identity) as GameObject;
cursor.transform.Rotate (new Vector3(90, 0, 0));
unitSelected = false;
showActions = false;
}
// Update is called once per frame
@ -84,8 +90,16 @@ public class TurnManagerScript : MonoBehaviour {
timeExp = 0.0f;
}
if (Input.GetKeyUp (KeyCode.Space)) {
Vector2 tilePosition = cursor.transform.position;
if (Input.GetKeyUp (KeyCode.Space) && !unitSelected) {
Vector3 tilePosition = cursor.transform.position;
int cpos = (int)tilePosition.z * (int)mapSize.x + (int)tilePosition.x;
GameObject c = charMap [cpos];
//UnitBehaviour ub = c.GetComponent<UnitBehaviour> ();
if (c != null) {
unitSelected = true;
showActions = true;
}
//Obtener GameObject de la matriz luego extraer sus funciones
//Mostrar opciones y elegir una
//Ejecutar acción
@ -117,5 +131,11 @@ public class TurnManagerScript : MonoBehaviour {
actualNumFinishedChars = 0;
}
void OnGUI(){
if (showActions) {
GUI.Box (new Rect(0, 0, 100, 100), "Move");
GUI.Box (new Rect(100, 0, 100, 100), "Attack");
}
}
}

View file

@ -37,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(posZ*(int)mapSize.x+posX, unit);
if (team == UnitBehaviour.Team.Player && playerLichScript == null )
playerLichScript = unit.GetComponent<UnitBehaviour> ();
@ -46,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(posZ*(int)mapSize.x+posX, unit);
if (team == UnitBehaviour.Team.Enemy1) {