From bab35ae71fd35b2f54563705a441ead98d9d975e Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 29 Apr 2019 20:47:35 +0200 Subject: [PATCH] Update prefabs --- Assets/Prefabs/Entities/SHOP Rapier.prefab | 4 ++-- Assets/Prefabs/Entities/SHOP Sword.prefab | 4 ++-- Assets/Scripts/EntityItemShopSword.cs | 5 ++--- Assets/Scripts/EntityMonster.cs | 4 ++-- Assets/Scripts/Map.cs | 10 +++++++++- Assets/Sprites/Candle1.png.meta | 2 +- Assets/Sprites/Candle2.png.meta | 2 +- Assets/Sprites/Candle3.png.meta | 2 +- Assets/Sprites/Candle4.png.meta | 2 +- Assets/Sprites/Candle5.png.meta | 2 +- 10 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Assets/Prefabs/Entities/SHOP Rapier.prefab b/Assets/Prefabs/Entities/SHOP Rapier.prefab index c3bbb7f..7af8ef8 100644 --- a/Assets/Prefabs/Entities/SHOP Rapier.prefab +++ b/Assets/Prefabs/Entities/SHOP Rapier.prefab @@ -96,8 +96,8 @@ MonoBehaviour: overlappable: 1 hpMax: 1 hp: 1 - hpChange: -1 - maxHpChange: -1 + hpChange: -2 + maxHpChange: -2 damage: 3 attackAnimation: {fileID: 5896060810164205279, guid: 602b69921902efc44ab8a008655b6574, type: 3} diff --git a/Assets/Prefabs/Entities/SHOP Sword.prefab b/Assets/Prefabs/Entities/SHOP Sword.prefab index 7a09832..0e80a1b 100644 --- a/Assets/Prefabs/Entities/SHOP Sword.prefab +++ b/Assets/Prefabs/Entities/SHOP Sword.prefab @@ -96,8 +96,8 @@ MonoBehaviour: overlappable: 1 hpMax: 1 hp: 0 - hpChange: -1 - maxHpChange: -1 + hpChange: -6 + maxHpChange: -6 damage: 5 attackAnimation: {fileID: 5896060810164205279, guid: 602b69921902efc44ab8a008655b6574, type: 3} diff --git a/Assets/Scripts/EntityItemShopSword.cs b/Assets/Scripts/EntityItemShopSword.cs index 9bbcc54..fae9512 100644 --- a/Assets/Scripts/EntityItemShopSword.cs +++ b/Assets/Scripts/EntityItemShopSword.cs @@ -15,9 +15,8 @@ public class EntityItemShopSword : EntityItemShop { protected override void OnPurchase(EntityPlayer player) { Destroy(player.GetComponent()); - player.gameObject.AddComponent(); - PlayerAttackMelee pam = player.GetComponent(); + PlayerAttackMelee pam = player.gameObject.AddComponent(); pam.damage = this.damage; - pam.attackAnimation = attackAnimation; + pam.attackAnimation = this.attackAnimation; } } \ No newline at end of file diff --git a/Assets/Scripts/EntityMonster.cs b/Assets/Scripts/EntityMonster.cs index 599a1ef..853ea5c 100644 --- a/Assets/Scripts/EntityMonster.cs +++ b/Assets/Scripts/EntityMonster.cs @@ -6,8 +6,8 @@ public class EntityMonster : Entity { public string monsterName; - public virtual void OnTurn(){ - Debug.LogWarning("OnTurn() not overridden"); + public virtual void OnTurn() { + //Do nothing. } public override void Die() { diff --git a/Assets/Scripts/Map.cs b/Assets/Scripts/Map.cs index 988595e..93f1ede 100644 --- a/Assets/Scripts/Map.cs +++ b/Assets/Scripts/Map.cs @@ -131,7 +131,9 @@ public class Map : MonoBehaviour public bool CanMoveTo(Vector2Int position) { try { - bool walkable = GetTile(position).walkable; + MapTile tile = GetTile(position); + if(tile == null) return false; + bool walkable = tile.walkable; List entities = turnHandler.GetEntitiesAtPosition(position); bool free = true; foreach(Entity entity in entities) { @@ -257,6 +259,9 @@ public class Map : MonoBehaviour for(int i = 0; i < enemiesToSpawn; i++) { MapRoom room = rooms[Random.Range(0, rooms.Count)]; Vector2Int point = room.RandomPoint(); + if(turnHandler.GetEntitiesAtPosition(point).Count > 0) { + continue; + } GameObject enemyPrefab = enemyPrefabs[Random.Range(0, enemyPrefabs.Count)]; GameObject enemyObject = Instantiate(enemyPrefab, turnHandler.transform); enemyObject.name = "Enemy " + i.ToString(); @@ -268,6 +273,9 @@ public class Map : MonoBehaviour for(int i = 0; i < curiositiesToSpawn; i++) { MapRoom room = rooms[Random.Range(0, rooms.Count)]; Vector2Int point = room.RandomPoint(); + if(turnHandler.GetEntitiesAtPosition(point).Count > 0) { + continue; + } GameObject curiosityPrefab = curiositiesPrefabs[Random.Range(0, curiositiesPrefabs.Count)]; GameObject curiosityObject = Instantiate(curiosityPrefab, turnHandler.transform); curiosityObject.name = "Curiosity " + i.ToString(); diff --git a/Assets/Sprites/Candle1.png.meta b/Assets/Sprites/Candle1.png.meta index 8d49723..317839b 100644 --- a/Assets/Sprites/Candle1.png.meta +++ b/Assets/Sprites/Candle1.png.meta @@ -97,7 +97,7 @@ TextureImporter: outline: [] physicsShape: [] bones: [] - spriteID: da5d40c84f8595f47b80dcea5d2deb3a + spriteID: 3e6eb75314db5e244bebb22f21c94026 internalID: 0 vertices: [] indices: diff --git a/Assets/Sprites/Candle2.png.meta b/Assets/Sprites/Candle2.png.meta index b7afd62..529e05b 100644 --- a/Assets/Sprites/Candle2.png.meta +++ b/Assets/Sprites/Candle2.png.meta @@ -97,7 +97,7 @@ TextureImporter: outline: [] physicsShape: [] bones: [] - spriteID: b492c21463e3a0f4a9b0be683bd11dda + spriteID: 6be7daae85043be438bbec5cd6228385 internalID: 0 vertices: [] indices: diff --git a/Assets/Sprites/Candle3.png.meta b/Assets/Sprites/Candle3.png.meta index 2906292..4764340 100644 --- a/Assets/Sprites/Candle3.png.meta +++ b/Assets/Sprites/Candle3.png.meta @@ -97,7 +97,7 @@ TextureImporter: outline: [] physicsShape: [] bones: [] - spriteID: 7c02f5004020e06428309e8025378000 + spriteID: 386bca1aff16bf940a124f9e4fd86f4b internalID: 0 vertices: [] indices: diff --git a/Assets/Sprites/Candle4.png.meta b/Assets/Sprites/Candle4.png.meta index 0c2270a..843577a 100644 --- a/Assets/Sprites/Candle4.png.meta +++ b/Assets/Sprites/Candle4.png.meta @@ -97,7 +97,7 @@ TextureImporter: outline: [] physicsShape: [] bones: [] - spriteID: 9f0d734ca5077c34f8b6bfb253e68903 + spriteID: 7021a274552590543af602108d3f2751 internalID: 0 vertices: [] indices: diff --git a/Assets/Sprites/Candle5.png.meta b/Assets/Sprites/Candle5.png.meta index d6f809d..63f800b 100644 --- a/Assets/Sprites/Candle5.png.meta +++ b/Assets/Sprites/Candle5.png.meta @@ -97,7 +97,7 @@ TextureImporter: outline: [] physicsShape: [] bones: [] - spriteID: 554f6d8e091900346aa7a07426a523ee + spriteID: ac8a71570b1ff934596f7800b57ecfd2 internalID: 0 vertices: [] indices: