This commit is contained in:
vylion 2016-11-02 13:54:45 +01:00
parent dec95f2e7d
commit fb85a6086b
5 changed files with 25 additions and 6 deletions

View file

@ -30,6 +30,7 @@ public class MapCreation : MonoBehaviour {
public Texture2D[] texture_wall; //Vector con las texturas de las paredes
void Start () {
delimiter_objects = new GameObject[0];
//Variable de instancia temporal
GameObject basic_instance = Instantiate(light_form,new Vector3(0,5,0), Quaternion.identity) as GameObject;
basic_instance.transform.Rotate (lf);
@ -72,11 +73,12 @@ public class MapCreation : MonoBehaviour {
}
public void removeZone(){
delimiter_objects = GameObject.FindGameObjectsWithTag ("Delimiter");
Debug.Log("Delimiters: " + delimiter_objects.Length);
foreach (GameObject g in delimiter_objects) {
g.GetComponent<Remove> ().Die ();
if(g != null) g.GetComponent<Remove> ().Die ();
}
}
public void markZone(int x, int z, int area, Color color){
public void markZone(int x, int z, int area){
/**
* SE TIENE QUE MEJORAR, PERO YA, DEL ROLLO, INMEDIATLY
* */

View file

@ -22,7 +22,7 @@ public class TestController : MonoBehaviour {
GameObject to = Instantiate (generator);
Vector3 horientacion = new Vector3 (45, -45, 0);
to.GetComponent<MapCreation> ().setMatrix (matrix,12,7,horientacion,0.8f,Color.white/1.2f);
to.GetComponent<MapCreation> ().markZone (3, 4, 2, Color.black);
to.GetComponent<MapCreation> ().markZone (3, 4, 2);
//to = Instantiate (audiocontroler);
//to.GetComponent<AudioManager> ().setAudioManager ("background.wav","Assets/AudioManager/Sounds");
}

View file

@ -50,7 +50,7 @@ public class Generator : MonoBehaviour {
tScript.mapSize = new Vector2 (20, 40);
tScript.terrain = map;
inputMan.GetComponent<InputManagerScript> ().setTurnMan(tScript);
inputMan.GetComponent<InputManagerScript> ().setMapCreat(mScript);
}
// Update is called once per frame

View file

@ -36,6 +36,7 @@ public class InputManagerScript : MonoBehaviour {
private MyColor currentCursorColor = MyColor.cyan;
private TurnManagerScript tms;
private MapCreation mc;
// Use this for initialization
void Start () {
@ -65,6 +66,7 @@ public class InputManagerScript : MonoBehaviour {
if (Input.GetKeyDown (KeyCode.Escape)) {
openMenu = false;
unitMenu = false;
//mc.removeZone ();
for (int i = 0; i < menuOptions.Length; i++) {
DestroyObject (menuOptions [i]);
}
@ -94,6 +96,14 @@ public class InputManagerScript : MonoBehaviour {
unitMenu = false;
unitActionSelected = true;
changeCursorColor(MyColor.green);
Vector3 pos = cursor.transform.position;
selectedGO = tms.getUnitAtTile((int) pos.z, (int) pos.x);
UnitBehaviour ub = selectedGO.GetComponent<UnitBehaviour> ();
//if(actionOption == 0)
//mc.markZone ((int) pos.x, (int) pos.z, ub.attackRange);
//else if(actionOption == 1)
//mc.markZone ((int) pos.x, (int) pos.z, ub.stepLength);
} else {
if (actionOption == 0) {
endTurn ();
@ -135,6 +145,7 @@ public class InputManagerScript : MonoBehaviour {
if (Input.GetKeyDown (KeyCode.Escape)) {
if (unitActionSelected) {
unitActionSelected = false;
//mc.removeZone ();
}
openMenu = false;
changeCursorColor (MyColor.cyan);
@ -168,6 +179,7 @@ public class InputManagerScript : MonoBehaviour {
}
unitActionSelected = false;
//mc.removeZone ();
selectedGO = null;
actionOption = -1;
@ -289,6 +301,10 @@ public class InputManagerScript : MonoBehaviour {
tms = s;
}
public void setMapCreat(MapCreation s) {
mc = s;
}
void endTurn() {
tms.changeTeam ();
}

View file

@ -3,7 +3,8 @@
--- !u!78 &1
TagManager:
serializedVersion: 2
tags: []
tags:
- Delimiter
layers:
- Default
- TransparentFX