From 09333ab4dd79e7bee5cdfc622b98c62a2810f88b Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 28 Apr 2019 16:34:50 +0200 Subject: [PATCH] Abuse of the refactor function --- Assets/Prefabs/MainCamera.prefab | 85 -------- Assets/Prefabs/MainCamera.prefab.meta | 7 - Assets/Prefabs/Player.prefab | 198 +++++++++--------- Assets/Prefabs/Slime.prefab | 38 ++-- Assets/Prefabs/TEST Item.prefab | 6 +- Assets/Scripts/{Item.cs => EntityItem.cs} | 4 +- .../{AISlime.cs.meta => EntityItem.cs.meta} | 2 +- Assets/Scripts/{AI.cs => EntityMonster.cs} | 2 +- .../{Player.cs.meta => EntityMonster.cs.meta} | 2 +- .../{AISlime.cs => EntityMonsterSlime.cs} | 6 +- ...tem.cs.meta => EntityMonsterSlime.cs.meta} | 2 +- Assets/Scripts/{Player.cs => EntityPlayer.cs} | 6 +- .../{AI.cs.meta => EntityPlayer.cs.meta} | 2 +- Assets/Scripts/FillAmountFromPlayerHP.cs | 4 +- Assets/Scripts/Map.cs | 12 +- Assets/Scripts/{Tile.cs => MapTile.cs} | 2 +- .../Scripts/{Tile.cs.meta => MapTile.cs.meta} | 0 Assets/Scripts/PlayerAttack.cs | 4 +- ...erAttack_Melee.cs => PlayerAttackMelee.cs} | 2 +- Assets/Scripts/PlayerAttackMelee.cs.meta | 11 + Assets/Scripts/PlayerAttack_Melee.cs.meta | 11 - Assets/Scripts/TurnHandler.cs | 4 +- 22 files changed, 163 insertions(+), 247 deletions(-) delete mode 100644 Assets/Prefabs/MainCamera.prefab delete mode 100644 Assets/Prefabs/MainCamera.prefab.meta rename Assets/Scripts/{Item.cs => EntityItem.cs} (85%) rename Assets/Scripts/{AISlime.cs.meta => EntityItem.cs.meta} (83%) rename Assets/Scripts/{AI.cs => EntityMonster.cs} (83%) rename Assets/Scripts/{Player.cs.meta => EntityMonster.cs.meta} (83%) rename Assets/Scripts/{AISlime.cs => EntityMonsterSlime.cs} (94%) rename Assets/Scripts/{Item.cs.meta => EntityMonsterSlime.cs.meta} (83%) rename Assets/Scripts/{Player.cs => EntityPlayer.cs} (95%) rename Assets/Scripts/{AI.cs.meta => EntityPlayer.cs.meta} (83%) rename Assets/Scripts/{Tile.cs => MapTile.cs} (90%) rename Assets/Scripts/{Tile.cs.meta => MapTile.cs.meta} (100%) rename Assets/Scripts/{PlayerAttack_Melee.cs => PlayerAttackMelee.cs} (90%) create mode 100644 Assets/Scripts/PlayerAttackMelee.cs.meta delete mode 100644 Assets/Scripts/PlayerAttack_Melee.cs.meta diff --git a/Assets/Prefabs/MainCamera.prefab b/Assets/Prefabs/MainCamera.prefab deleted file mode 100644 index a1cac78..0000000 --- a/Assets/Prefabs/MainCamera.prefab +++ /dev/null @@ -1,85 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &7475959774386308610 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 7475959774386308609} - - component: {fileID: 7475959774386308608} - - component: {fileID: 7475959774386308611} - m_Layer: 0 - m_Name: Main Camera - m_TagString: MainCamera - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &7475959774386308609 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7475959774386308610} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: -10} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!20 &7475959774386308608 -Camera: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7475959774386308610} - m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} - m_projectionMatrixMode: 1 - m_GateFitMode: 2 - m_FOVAxisMode: 0 - m_SensorSize: {x: 36, y: 24} - m_LensShift: {x: 0, y: 0} - m_FocalLength: 50 - m_NormalizedViewPortRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - near clip plane: 0.3 - far clip plane: 1000 - field of view: 60 - orthographic: 1 - orthographic size: 8 - m_Depth: -1 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} - m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 1 - m_AllowMSAA: 1 - m_AllowDynamicResolution: 0 - m_ForceIntoRT: 0 - m_OcclusionCulling: 1 - m_StereoConvergence: 10 - m_StereoSeparation: 0.022 ---- !u!81 &7475959774386308611 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7475959774386308610} - m_Enabled: 1 diff --git a/Assets/Prefabs/MainCamera.prefab.meta b/Assets/Prefabs/MainCamera.prefab.meta deleted file mode 100644 index 03dd195..0000000 --- a/Assets/Prefabs/MainCamera.prefab.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 04409c352bfbdea4b9830f11d7b4d40e -PrefabImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index b04f372..54512d2 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -1,5 +1,88 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &2894367173346332696 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2894367173346332699} + - component: {fileID: 2894367173346332698} + - component: {fileID: 2894367173346332697} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2894367173346332699 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2894367173346332696} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2935319493830293414} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!20 &2894367173346332698 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2894367173346332696} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 8 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!81 &2894367173346332697 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2894367173346332696} + m_Enabled: 1 --- !u!1 &2935319493830293412 GameObject: m_ObjectHideFlags: 0 @@ -9,8 +92,8 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 2935319493830293414} - - component: {fileID: 2935319493830293413} - component: {fileID: -5893075763862095451} + - component: {fileID: 2935319493830293413} - component: {fileID: 8856581523727923621} m_Layer: 0 m_Name: Player @@ -34,24 +117,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &2935319493830293413 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2935319493830293412} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4de6b97c3d785d146a0df2c1c078fe91, type: 3} - m_Name: - m_EditorClassIdentifier: - hpMax: 10 - overlappable: 0 - hp: 10 - sprite: {fileID: 21300000, guid: 88f4c277892ae9449a57b321cd810bce, type: 3} - exp: 0 - level: 0 --- !u!212 &-5893075763862095451 SpriteRenderer: m_ObjectHideFlags: 0 @@ -100,6 +165,24 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!114 &2935319493830293413 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2935319493830293412} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f16e1b4841b0d4546a52853aafbb7d85, type: 3} + m_Name: + m_EditorClassIdentifier: + hpMax: 0 + overlappable: 0 + hp: 0 + sprite: {fileID: 0} + exp: 0 + level: 0 --- !u!114 &8856581523727923621 MonoBehaviour: m_ObjectHideFlags: 0 @@ -109,82 +192,7 @@ MonoBehaviour: m_GameObject: {fileID: 2935319493830293412} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 05a8e698d12930547a9e83f369e506d2, type: 3} + m_Script: {fileID: 11500000, guid: 0cb881aee511ed643880a50159d731b7, type: 3} m_Name: m_EditorClassIdentifier: damage: 1 ---- !u!1001 &5734536248370648602 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 2935319493830293414} - m_Modifications: - - target: {fileID: 7475959774386308610, guid: 04409c352bfbdea4b9830f11d7b4d40e, - type: 3} - propertyPath: m_Name - value: Main Camera - objectReference: {fileID: 0} - - target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e, - type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e, - type: 3} - propertyPath: m_LocalPosition.z - value: -10 - objectReference: {fileID: 0} - - target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e, - type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e, - type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e, - type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e, - type: 3} - propertyPath: m_RootOrder - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 04409c352bfbdea4b9830f11d7b4d40e, type: 3} ---- !u!4 &2894367173346332699 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 7475959774386308609, guid: 04409c352bfbdea4b9830f11d7b4d40e, - type: 3} - m_PrefabInstance: {fileID: 5734536248370648602} - m_PrefabAsset: {fileID: 0} diff --git a/Assets/Prefabs/Slime.prefab b/Assets/Prefabs/Slime.prefab index e687bba..b3bc9aa 100644 --- a/Assets/Prefabs/Slime.prefab +++ b/Assets/Prefabs/Slime.prefab @@ -9,8 +9,8 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 2043533519980591455} - - component: {fileID: 571363246873614695} - component: {fileID: 1351652798109185028} + - component: {fileID: 571363246873614695} m_Layer: 0 m_Name: Slime m_TagString: Untagged @@ -32,24 +32,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &571363246873614695 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1164136568549368904} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 2fcfe4b94620b234fb7a294bf4453a69, type: 3} - m_Name: - m_EditorClassIdentifier: - hpMax: 2 - overlappable: 0 - hp: 0 - sprite: {fileID: 21300000, guid: ee7ef72c830dc204c9df0595e161f049, type: 3} - moveChance: 0.5 - visionRange: 4 --- !u!212 &1351652798109185028 SpriteRenderer: m_ObjectHideFlags: 0 @@ -98,3 +80,21 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!114 &571363246873614695 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1164136568549368904} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1ce1b6adc640d6f46bbf4d7072735b7f, type: 3} + m_Name: + m_EditorClassIdentifier: + hpMax: 0 + overlappable: 0 + hp: 0 + sprite: {fileID: 0} + moveChance: 0.5 + visionRange: 4 diff --git a/Assets/Prefabs/TEST Item.prefab b/Assets/Prefabs/TEST Item.prefab index 00c5c0f..ea25af2 100644 --- a/Assets/Prefabs/TEST Item.prefab +++ b/Assets/Prefabs/TEST Item.prefab @@ -41,13 +41,13 @@ MonoBehaviour: m_GameObject: {fileID: 470211819356819165} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 1f0883433553dbb4fa23a815949f596b, type: 3} + m_Script: {fileID: 11500000, guid: cfb3c44da9ebb1840b5a2bcdfd5e2730, type: 3} m_Name: m_EditorClassIdentifier: - hpMax: 1 + hpMax: 0 overlappable: 0 hp: 0 - sprite: {fileID: 21300000, guid: 5e4d29e1adc2ea0429b199b82253416c, type: 3} + sprite: {fileID: 0} --- !u!212 &7501912107144583665 SpriteRenderer: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Item.cs b/Assets/Scripts/EntityItem.cs similarity index 85% rename from Assets/Scripts/Item.cs rename to Assets/Scripts/EntityItem.cs index d115ecc..c68562e 100644 --- a/Assets/Scripts/Item.cs +++ b/Assets/Scripts/EntityItem.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class Item : Entity +public class EntityItem : Entity { public static string itemName = "White Triangle"; @@ -11,7 +11,7 @@ public class Item : Entity overlappable = true; } - public virtual void OnPickup(Player player) { + public virtual void OnPickup(EntityPlayer player) { Debug.LogWarning("OnPickup not overridden"); messageBar.Write("Picked up: " + itemName, Color.yellow); Destroy(gameObject); diff --git a/Assets/Scripts/AISlime.cs.meta b/Assets/Scripts/EntityItem.cs.meta similarity index 83% rename from Assets/Scripts/AISlime.cs.meta rename to Assets/Scripts/EntityItem.cs.meta index 9c04775..45a55ad 100644 --- a/Assets/Scripts/AISlime.cs.meta +++ b/Assets/Scripts/EntityItem.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2fcfe4b94620b234fb7a294bf4453a69 +guid: cfb3c44da9ebb1840b5a2bcdfd5e2730 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/AI.cs b/Assets/Scripts/EntityMonster.cs similarity index 83% rename from Assets/Scripts/AI.cs rename to Assets/Scripts/EntityMonster.cs index fd30b46..d724cd9 100644 --- a/Assets/Scripts/AI.cs +++ b/Assets/Scripts/EntityMonster.cs @@ -2,7 +2,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public class AI : Entity +public class EntityMonster : Entity { public virtual void OnTurn(){ Debug.LogWarning("OnTurn() not overridden"); diff --git a/Assets/Scripts/Player.cs.meta b/Assets/Scripts/EntityMonster.cs.meta similarity index 83% rename from Assets/Scripts/Player.cs.meta rename to Assets/Scripts/EntityMonster.cs.meta index 4cba488..1e746d3 100644 --- a/Assets/Scripts/Player.cs.meta +++ b/Assets/Scripts/EntityMonster.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4de6b97c3d785d146a0df2c1c078fe91 +guid: aec5e971190b4b544a78be24566f9e6c MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/AISlime.cs b/Assets/Scripts/EntityMonsterSlime.cs similarity index 94% rename from Assets/Scripts/AISlime.cs rename to Assets/Scripts/EntityMonsterSlime.cs index 85306a3..f1234de 100644 --- a/Assets/Scripts/AISlime.cs +++ b/Assets/Scripts/EntityMonsterSlime.cs @@ -2,15 +2,15 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public class AISlime : AI +public class EntityMonsterSlime : EntityMonster { public float moveChance = 0.5f; public float visionRange = 4; - protected Player player; + protected EntityPlayer player; protected new void Start() { base.Start(); - player = GameObject.FindGameObjectWithTag("Player").GetComponent(); + player = GameObject.FindGameObjectWithTag("Player").GetComponent(); } public override void OnTurn(){ diff --git a/Assets/Scripts/Item.cs.meta b/Assets/Scripts/EntityMonsterSlime.cs.meta similarity index 83% rename from Assets/Scripts/Item.cs.meta rename to Assets/Scripts/EntityMonsterSlime.cs.meta index 0b76504..3495293 100644 --- a/Assets/Scripts/Item.cs.meta +++ b/Assets/Scripts/EntityMonsterSlime.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1f0883433553dbb4fa23a815949f596b +guid: 1ce1b6adc640d6f46bbf4d7072735b7f MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/EntityPlayer.cs similarity index 95% rename from Assets/Scripts/Player.cs rename to Assets/Scripts/EntityPlayer.cs index 6f57ee4..f30698d 100644 --- a/Assets/Scripts/Player.cs +++ b/Assets/Scripts/EntityPlayer.cs @@ -7,7 +7,7 @@ public enum ControlMode { Attack } -public class Player : Entity +public class EntityPlayer : Entity { public int exp; public int level; @@ -98,8 +98,8 @@ public class Player : Entity //Check for pickuppable items List entities = turnHandler.GetEntitiesAtPosition(MapPosition); foreach(Entity entity in entities) { - if(entity is Item) { - Item item = entity as Item; + if(entity is EntityItem) { + EntityItem item = entity as EntityItem; item.OnPickup(this); } } diff --git a/Assets/Scripts/AI.cs.meta b/Assets/Scripts/EntityPlayer.cs.meta similarity index 83% rename from Assets/Scripts/AI.cs.meta rename to Assets/Scripts/EntityPlayer.cs.meta index 438e77b..370a2be 100644 --- a/Assets/Scripts/AI.cs.meta +++ b/Assets/Scripts/EntityPlayer.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e694420377849854db7a2686ff36420c +guid: f16e1b4841b0d4546a52853aafbb7d85 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/FillAmountFromPlayerHP.cs b/Assets/Scripts/FillAmountFromPlayerHP.cs index db83a6c..be01f33 100644 --- a/Assets/Scripts/FillAmountFromPlayerHP.cs +++ b/Assets/Scripts/FillAmountFromPlayerHP.cs @@ -5,11 +5,11 @@ using UnityEngine.UI; public class FillAmountFromPlayerHP : MonoBehaviour { - private Player player; + private EntityPlayer player; private Image image; private void Start() { - player = GameObject.FindGameObjectWithTag("Player").GetComponent(); + player = GameObject.FindGameObjectWithTag("Player").GetComponent(); image = GetComponent(); } diff --git a/Assets/Scripts/Map.cs b/Assets/Scripts/Map.cs index 8afa7d2..a5f6c3d 100644 --- a/Assets/Scripts/Map.cs +++ b/Assets/Scripts/Map.cs @@ -124,10 +124,10 @@ public class Map : MonoBehaviour private List rooms; private TurnHandler turnHandler; - public Tile GetTile(Vector2Int position) { + public MapTile GetTile(Vector2Int position) { try { GameObject tileObject = tiles[position.x, position.y]; - return tileObject.GetComponent(); + return tileObject.GetComponent(); } catch(System.IndexOutOfRangeException) { return null; @@ -151,7 +151,7 @@ public class Map : MonoBehaviour } private void EditTile(Vector2Int position, bool walkable, bool roomPart) { - Tile tile = GetTile(position); + MapTile tile = GetTile(position); tile.walkable = walkable; tile.roomPart |= roomPart; } @@ -163,7 +163,7 @@ public class Map : MonoBehaviour tileObject.transform.position = new Vector3(x, y, 0); tiles[x, y] = tileObject; tileObject.name = "Tile [" + x.ToString() + ", " + y.ToString() + "]"; - Tile tile = tileObject.GetComponent(); + MapTile tile = tileObject.GetComponent(); tile.walkable = false; } } @@ -270,8 +270,8 @@ public class Map : MonoBehaviour public void GenerateTileSprites() { for(int x = 0; x < mapSize; x++) { for(int y = 0; y < mapSize; y++) { - Tile tile = GetTile(new Vector2Int(x, y)); - Tile otherTile; + MapTile tile = GetTile(new Vector2Int(x, y)); + MapTile otherTile; if(tile.walkable) tile.sprite = SampleSprite(floorSprites); else if((bool)(otherTile = GetTile(new Vector2Int(x, y+1))) && otherTile.walkable) tile.sprite = SampleSprite(botWallSprites); else if((bool)(otherTile = GetTile(new Vector2Int(x, y+1))) && otherTile.walkable) tile.sprite = SampleSprite(topWallSprites); diff --git a/Assets/Scripts/Tile.cs b/Assets/Scripts/MapTile.cs similarity index 90% rename from Assets/Scripts/Tile.cs rename to Assets/Scripts/MapTile.cs index 04dec14..847627a 100644 --- a/Assets/Scripts/Tile.cs +++ b/Assets/Scripts/MapTile.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine; -public class Tile : MonoBehaviour +public class MapTile : MonoBehaviour { public bool walkable; public bool roomPart; diff --git a/Assets/Scripts/Tile.cs.meta b/Assets/Scripts/MapTile.cs.meta similarity index 100% rename from Assets/Scripts/Tile.cs.meta rename to Assets/Scripts/MapTile.cs.meta diff --git a/Assets/Scripts/PlayerAttack.cs b/Assets/Scripts/PlayerAttack.cs index 2f33699..b9b5d11 100644 --- a/Assets/Scripts/PlayerAttack.cs +++ b/Assets/Scripts/PlayerAttack.cs @@ -4,13 +4,13 @@ using UnityEngine; public class PlayerAttack : MonoBehaviour { - protected Player player; + protected EntityPlayer player; protected GameObject gameController; protected TurnHandler turnHandler; protected Map map; protected void Start() { - player = GetComponent(); + player = GetComponent(); gameController = GameObject.FindGameObjectWithTag("GameController"); turnHandler = gameController.GetComponentInChildren(); map = gameController.GetComponentInChildren(); diff --git a/Assets/Scripts/PlayerAttack_Melee.cs b/Assets/Scripts/PlayerAttackMelee.cs similarity index 90% rename from Assets/Scripts/PlayerAttack_Melee.cs rename to Assets/Scripts/PlayerAttackMelee.cs index 81f67d6..936f9da 100644 --- a/Assets/Scripts/PlayerAttack_Melee.cs +++ b/Assets/Scripts/PlayerAttackMelee.cs @@ -2,7 +2,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public class PlayerAttack_Melee : PlayerAttack +public class PlayerAttackMelee : PlayerAttack { public float damage = 1f; diff --git a/Assets/Scripts/PlayerAttackMelee.cs.meta b/Assets/Scripts/PlayerAttackMelee.cs.meta new file mode 100644 index 0000000..9a4a586 --- /dev/null +++ b/Assets/Scripts/PlayerAttackMelee.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0cb881aee511ed643880a50159d731b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlayerAttack_Melee.cs.meta b/Assets/Scripts/PlayerAttack_Melee.cs.meta deleted file mode 100644 index ad531d2..0000000 --- a/Assets/Scripts/PlayerAttack_Melee.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 05a8e698d12930547a9e83f369e506d2 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/TurnHandler.cs b/Assets/Scripts/TurnHandler.cs index bd41358..3165f09 100644 --- a/Assets/Scripts/TurnHandler.cs +++ b/Assets/Scripts/TurnHandler.cs @@ -12,8 +12,8 @@ public class TurnHandler : MonoBehaviour entity.Die(); } //Move AIs - if(entity is AI) { - AI ai = entity as AI; + if(entity is EntityMonster) { + EntityMonster ai = entity as EntityMonster; ai.OnTurn(); } }