From fb85a6086b95b15f63853c5af1db5dcec68137ba Mon Sep 17 00:00:00 2001 From: vylion Date: Wed, 2 Nov 2016 13:54:45 +0100 Subject: [PATCH] cosas --- Assets/FloorCreator/MapCreation.cs | 6 ++++-- Assets/FloorCreator/TestController.cs | 2 +- Assets/Generator.cs | 4 ++-- Assets/InputManagerScript.cs | 16 ++++++++++++++++ ProjectSettings/TagManager.asset | 3 ++- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Assets/FloorCreator/MapCreation.cs b/Assets/FloorCreator/MapCreation.cs index 1b5e153..47005b0 100644 --- a/Assets/FloorCreator/MapCreation.cs +++ b/Assets/FloorCreator/MapCreation.cs @@ -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 ().Die (); + if(g != null) g.GetComponent ().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 * */ diff --git a/Assets/FloorCreator/TestController.cs b/Assets/FloorCreator/TestController.cs index 1deedec..5fe543a 100644 --- a/Assets/FloorCreator/TestController.cs +++ b/Assets/FloorCreator/TestController.cs @@ -22,7 +22,7 @@ public class TestController : MonoBehaviour { GameObject to = Instantiate (generator); Vector3 horientacion = new Vector3 (45, -45, 0); to.GetComponent ().setMatrix (matrix,12,7,horientacion,0.8f,Color.white/1.2f); - to.GetComponent ().markZone (3, 4, 2, Color.black); + to.GetComponent ().markZone (3, 4, 2); //to = Instantiate (audiocontroler); //to.GetComponent ().setAudioManager ("background.wav","Assets/AudioManager/Sounds"); } diff --git a/Assets/Generator.cs b/Assets/Generator.cs index 82ac53a..f8ff884 100644 --- a/Assets/Generator.cs +++ b/Assets/Generator.cs @@ -50,11 +50,11 @@ public class Generator : MonoBehaviour { tScript.mapSize = new Vector2 (20, 40); tScript.terrain = map; inputMan.GetComponent ().setTurnMan(tScript); - + inputMan.GetComponent ().setMapCreat(mScript); } // Update is called once per frame void Update () { - + } } diff --git a/Assets/InputManagerScript.cs b/Assets/InputManagerScript.cs index a843cb8..15fd5e0 100644 --- a/Assets/InputManagerScript.cs +++ b/Assets/InputManagerScript.cs @@ -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 (); + //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 (); } diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 1c92a78..605d7f3 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -3,7 +3,8 @@ --- !u!78 &1 TagManager: serializedVersion: 2 - tags: [] + tags: + - Delimiter layers: - Default - TransparentFX