From 9b4c4bf7add7c8dc96e0766c72c439cf92bf15ec Mon Sep 17 00:00:00 2001 From: "falc@null.net" Date: Sat, 29 Oct 2016 03:27:06 +0200 Subject: [PATCH] mixed up --- Assets/TurnManagerScript.cs | 40 ++++++--- Assets/UnitCreator.cs | 4 +- Assets/scene1.unity | 166 +++++++++++++++++++++++++++--------- 3 files changed, 154 insertions(+), 56 deletions(-) diff --git a/Assets/TurnManagerScript.cs b/Assets/TurnManagerScript.cs index f240bf1..0b95758 100644 --- a/Assets/TurnManagerScript.cs +++ b/Assets/TurnManagerScript.cs @@ -9,33 +9,46 @@ public class TurnManagerScript : MonoBehaviour { public int playerNum = 2; public int iaNum = 0; public bool inTurn = true; - public List > charList; + //public List > charList; - public ArrayList terrain; - public ArrayList charMap; + public List terrain; + public List charMap; public Vector2 mapSize; private int actualPlayer; private int actualNumChars; private int actualNumFinishedChars; - private int actualChar; + + public GameObject cursor; // Use this for initialization void Start () { + //Estamos en turno inTurn = true; actualPlayer = 0; - actualNumChars = charList [actualPlayer].Count; + //actualNumChars = charList [actualPlayer].Count; // Characters that have finished its actions actualNumFinishedChars = 0; - actualChar = 0; } // Update is called once per frame void Update () { - if (Input.GetKeyUp (KeyCode.Space)) { - + if (Input.GetKey (KeyCode.LeftArrow)) { + cursor.transform.Translate (-1, 0, 0); + } + + if (Input.GetKey (KeyCode.RightArrow)) { + cursor.transform.Translate (1, 0, 0); + } + + if (Input.GetKey (KeyCode.UpArrow)) { + cursor.transform.Translate (0, 0, 1); + } + + if (Input.GetKey (KeyCode.DownArrow)) { + cursor.transform.Translate (0, 0, -1); } if (actualNumFinishedChars == actualNumChars) { @@ -44,16 +57,15 @@ public class TurnManagerScript : MonoBehaviour { } // Attack position (i,j) -> row i, column j - void attack(int i, int j) { - GameObject c = charMap [i * mapSize.x + j]; - - } + void execute(Action act, int i, int j) { + GameObject c = charMap [i * (int) mapSize.x + j]; + act (c); + } void changeTeam (int newTeam) { actualPlayer = newTeam; - actualNumChars = charList [actualPlayer].Count; + //actualNumChars = charList [actualPlayer].Count; actualNumFinishedChars = 0; - actualChar = 0; } } diff --git a/Assets/UnitCreator.cs b/Assets/UnitCreator.cs index d8a4451..966d3bd 100644 --- a/Assets/UnitCreator.cs +++ b/Assets/UnitCreator.cs @@ -31,7 +31,7 @@ public class UnitCreator : MonoBehaviour { GameObject lich; if (type == UnitType.Lich) { - lich = Instantiate (lichObject, posVec3, Quaternion.identity); + lich = Instantiate (lichObject, posVec3, Quaternion.identity) as GameObject; lich.GetComponent ().SetupStats (posX, posY, 3, 3, 100, 0, 0, 0); lich.GetComponent ().SetupBaseAttack (4, 2, 3); @@ -39,7 +39,7 @@ public class UnitCreator : MonoBehaviour { playerLich = lich.GetComponent (); } else if (type == UnitType.Skeleton) { GameObject skeleton; - skeleton = Instantiate (skeletonObject, posVec3, Quaternion.identity); + skeleton = Instantiate (skeletonObject, posVec3, Quaternion.identity) as GameObject; units.Add (skeleton); } } diff --git a/Assets/scene1.unity b/Assets/scene1.unity index 6f5911c..1bd3ea4 100644 --- a/Assets/scene1.unity +++ b/Assets/scene1.unity @@ -90,46 +90,6 @@ NavMeshSettings: cellSize: 0.16666667 manualCellSize: 0 m_NavMeshData: {fileID: 0} ---- !u!1 &154702854 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 154702856} - - 114: {fileID: 154702855} - m_Layer: 0 - m_Name: TurnManager - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &154702855 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 154702854} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 0f6c21b5c0a62dc408e8b6d4cc0253f3, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!4 &154702856 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 154702854} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -2.042461, y: 2.2867486, z: 1.3209662} - m_LocalScale: {x: 1, y: 1, z: 1} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 2 --- !u!1 &618114011 GameObject: m_ObjectHideFlags: 0 @@ -217,6 +177,53 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 +--- !u!1001 &902354652 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4000012397971404, guid: 0193d92a24b3bc94aad43f1f8c93643b, type: 2} + propertyPath: m_LocalPosition.x + value: -2.042461 + objectReference: {fileID: 0} + - target: {fileID: 4000012397971404, guid: 0193d92a24b3bc94aad43f1f8c93643b, type: 2} + propertyPath: m_LocalPosition.y + value: 2.2867486 + objectReference: {fileID: 0} + - target: {fileID: 4000012397971404, guid: 0193d92a24b3bc94aad43f1f8c93643b, type: 2} + propertyPath: m_LocalPosition.z + value: 1.3209662 + objectReference: {fileID: 0} + - target: {fileID: 4000012397971404, guid: 0193d92a24b3bc94aad43f1f8c93643b, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000012397971404, guid: 0193d92a24b3bc94aad43f1f8c93643b, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000012397971404, guid: 0193d92a24b3bc94aad43f1f8c93643b, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4000012397971404, guid: 0193d92a24b3bc94aad43f1f8c93643b, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4000012397971404, guid: 0193d92a24b3bc94aad43f1f8c93643b, type: 2} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 114000012696919310, guid: 0193d92a24b3bc94aad43f1f8c93643b, + type: 2} + propertyPath: cursor + value: + objectReference: {fileID: 1322998896} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 0193d92a24b3bc94aad43f1f8c93643b, type: 2} + m_IsPrefabParent: 0 --- !u!1 &1253882374 GameObject: m_ObjectHideFlags: 0 @@ -280,3 +287,82 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_RootOrder: 1 +--- !u!1 &1322998896 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1322998897} + - 33: {fileID: 1322998900} + - 65: {fileID: 1322998899} + - 23: {fileID: 1322998898} + m_Layer: 0 + m_Name: Cursor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1322998897 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1322998896} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.5, y: 0, z: 0.5} + m_LocalScale: {x: 1, y: 0.05, z: 1} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 +--- !u!23 &1322998898 +MeshRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1322998896} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_SelectedWireframeHidden: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!65 &1322998899 +BoxCollider: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1322998896} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &1322998900 +MeshFilter: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1322998896} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}