From c422045fcfb7dc6163a5b9eaad12b64e97f30c36 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 28 Apr 2019 00:29:23 +0200 Subject: [PATCH] Git merge something --- Assets/Prefabs/Main Camera.prefab | 4 ++-- Assets/Prefabs/Slime.prefab | 5 +++++ Assets/Scripts/AISlime.cs | 14 +++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Assets/Prefabs/Main Camera.prefab b/Assets/Prefabs/Main Camera.prefab index a69623d..572e376 100644 --- a/Assets/Prefabs/Main Camera.prefab +++ b/Assets/Prefabs/Main Camera.prefab @@ -42,7 +42,7 @@ Camera: m_Enabled: 1 serializedVersion: 2 m_ClearFlags: 1 - m_BackGroundColor: {r: 1, g: 1, b: 1, a: 0} + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 @@ -59,7 +59,7 @@ Camera: far clip plane: 1000 field of view: 60 orthographic: 1 - orthographic size: 5 + orthographic size: 7 m_Depth: -1 m_CullingMask: serializedVersion: 2 diff --git a/Assets/Prefabs/Slime.prefab b/Assets/Prefabs/Slime.prefab index 30a9177..7faae72 100644 --- a/Assets/Prefabs/Slime.prefab +++ b/Assets/Prefabs/Slime.prefab @@ -46,8 +46,13 @@ MonoBehaviour: m_EditorClassIdentifier: hpMax: 0 hp: 0 +<<<<<<< Updated upstream sprite: {fileID: 21300000, guid: ee7ef72c830dc204c9df0595e161f049, type: 3} visionRange: 4 +======= + sprite: {fileID: 21300000, guid: 0121970e693ee0a4d987bd5fe694ad67, type: 3} + visionRange: 2.5 +>>>>>>> Stashed changes --- !u!212 &1351652798109185028 SpriteRenderer: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/AISlime.cs b/Assets/Scripts/AISlime.cs index eaa3584..88bf0ca 100644 --- a/Assets/Scripts/AISlime.cs +++ b/Assets/Scripts/AISlime.cs @@ -14,7 +14,19 @@ public class AISlime : AI public override void OnTurn(){ if (CanSeePlayer()){ - //TODO + Vector2Int distance = player.MapPosition - MapPosition; + if (distance.x < 0 && map.CanMoveTo(MapPosition + Vector2Int.left)){ + transform.Translate(Vector3.left); + } + else if (distance.x > 0 && map.CanMoveTo(MapPosition + Vector2Int.right)){ + transform.Translate(Vector3.right); + } + else if (distance.y > 0 && map.CanMoveTo(MapPosition + Vector2Int.up)){ + transform.Translate(Vector3.up); + } + else if (distance.y < 0 && map.CanMoveTo(MapPosition + Vector2Int.down)){ + transform.Translate(Vector3.down); + } } else { int direction = Random.Range(0, 4);