1
Fork 0

Quite a lot of stuff

This commit is contained in:
Steffo 2019-04-27 22:19:35 +02:00
parent a23d6a3134
commit e9d1f2edb5
25 changed files with 657 additions and 580 deletions

View file

@ -1,51 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1164136568549368904
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2043533519980591455}
- component: {fileID: 7440667849060313208}
m_Layer: 0
m_Name: Enemy
m_TagString: Untagged
m_Icon: {fileID: 7174288486110832750, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2043533519980591455
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1164136568549368904}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 1.7943853, y: 1.0483005, z: -91.41211}
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!114 &7440667849060313208
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: a72ad0eb2136f284bab78f19fa561bb8, type: 3}
m_Name:
m_EditorClassIdentifier:
hpMax: 0
hp: 0
isUndead: 0
movesPerTurn: 0
hasSpottedPlayer: 0
sprite: {fileID: 0}

View file

@ -1,6 +1,6 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2866215097817665852
--- !u!1 &1792584738874209504
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -8,7 +8,7 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3211721187637284538}
- component: {fileID: 1419775483983031142}
m_Layer: 0
m_Name: GameController
m_TagString: GameController
@ -16,175 +16,131 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3211721187637284538
--- !u!4 &1419775483983031142
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2866215097817665852}
m_GameObject: {fileID: 1792584738874209504}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 5874724150191971617}
- {fileID: 368318821130531976}
- {fileID: 8897064855631282258}
- {fileID: 3789201758602335435}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1819628990077898199
PrefabInstance:
--- !u!1 &5605884945823581445
GameObject:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 3211721187637284538}
m_Modifications:
- target: {fileID: 1164136568549368904, guid: a4aeecfb369f0974490d158ef9489335,
type: 3}
propertyPath: m_Name
value: Enemy
objectReference: {fileID: 0}
- target: {fileID: 2043533519980591455, guid: a4aeecfb369f0974490d158ef9489335,
type: 3}
propertyPath: m_LocalPosition.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2043533519980591455, guid: a4aeecfb369f0974490d158ef9489335,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2043533519980591455, guid: a4aeecfb369f0974490d158ef9489335,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2043533519980591455, guid: a4aeecfb369f0974490d158ef9489335,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2043533519980591455, guid: a4aeecfb369f0974490d158ef9489335,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2043533519980591455, guid: a4aeecfb369f0974490d158ef9489335,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2043533519980591455, guid: a4aeecfb369f0974490d158ef9489335,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2043533519980591455, guid: a4aeecfb369f0974490d158ef9489335,
type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2043533519980591455, guid: a4aeecfb369f0974490d158ef9489335,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2043533519980591455, guid: a4aeecfb369f0974490d158ef9489335,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2043533519980591455, guid: a4aeecfb369f0974490d158ef9489335,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a4aeecfb369f0974490d158ef9489335, type: 3}
--- !u!4 &368318821130531976 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2043533519980591455, guid: a4aeecfb369f0974490d158ef9489335,
type: 3}
m_PrefabInstance: {fileID: 1819628990077898199}
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &8735699022713547399
PrefabInstance:
serializedVersion: 6
m_Component:
- component: {fileID: 3789201758602335435}
- component: {fileID: 5602184811824951751}
m_Layer: 0
m_Name: Map
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3789201758602335435
Transform:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 3211721187637284538}
m_Modifications:
- target: {fileID: 2935319493830293412, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
propertyPath: m_Name
value: Player
objectReference: {fileID: 0}
- target: {fileID: 2935319493830293412, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
propertyPath: m_Icon
value:
objectReference: {fileID: -5397416234189338067, guid: 0000000000000000d000000000000000,
type: 0}
- target: {fileID: 2935319493830293414, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2935319493830293414, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2935319493830293414, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2935319493830293414, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2935319493830293414, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2935319493830293414, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2935319493830293414, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2935319493830293414, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2935319493830293414, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2935319493830293414, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2935319493830293414, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e8ff38be23e53db40a793f6959c6f4ec, type: 3}
--- !u!4 &5874724150191971617 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2935319493830293414, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
m_PrefabInstance: {fileID: 8735699022713547399}
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5605884945823581445}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1419775483983031142}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &5602184811824951751
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5605884945823581445}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 052bc569472779a429bfc51246f723d4, type: 3}
m_Name:
m_EditorClassIdentifier:
mapSize: 40
roomsToGenerate: 8
minRoomSize: 2
maxRoomSize: 8
maxRoomIterations: 100
wallSprite: {fileID: 21300000, guid: f5be5362b22aa6c48993a720ec6c9b84, type: 3}
floorSprites:
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: fa4c9841fd8a5fb4f94ff78c95301065, type: 3}
tilePrefab: {fileID: 3219556109866242471, guid: 0e0b618b5499bbb40b076c0291d55487,
type: 3}
playerPrefab: {fileID: 2935319493830293412, guid: e8ff38be23e53db40a793f6959c6f4ec,
type: 3}
enemyPrefabs:
- {fileID: 1164136568549368904, guid: a4aeecfb369f0974490d158ef9489335, type: 3}
enemiesToSpawn: 10
--- !u!1 &8733140679003710819
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8897064855631282258}
- component: {fileID: 6815253418672446008}
m_Layer: 0
m_Name: Entities
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8897064855631282258
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8733140679003710819}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1419775483983031142}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &6815253418672446008
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8733140679003710819}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2447171af2ad9634498f2d769d7f5200, type: 3}
m_Name:
m_EditorClassIdentifier:

View file

@ -0,0 +1,85 @@
%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: 1, g: 1, b: 1, 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: 5
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

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: cd714ea41cb7c454994bf0f5ad99abd1
guid: 04409c352bfbdea4b9830f11d7b4d40e
PrefabImporter:
externalObjects: {}
userData:

View file

@ -1,66 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7249059666095778526
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7249059666095778521}
- component: {fileID: 6907631410461015020}
m_Layer: 0
m_Name: Map
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7249059666095778521
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7249059666095778526}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
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!114 &6907631410461015020
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7249059666095778526}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 052bc569472779a429bfc51246f723d4, type: 3}
m_Name:
m_EditorClassIdentifier:
mapSize: 30
roomsToGenerate: 5
minRoomSize: 2
maxRoomSize: 6
maxRoomIterations: 100
wallSprite: {fileID: 21300000, guid: f5be5362b22aa6c48993a720ec6c9b84, type: 3}
floorSprites:
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- {fileID: 21300000, guid: fa4c9841fd8a5fb4f94ff78c95301065, type: 3}
tilePrefab: {fileID: 3219556109866242471, guid: 0e0b618b5499bbb40b076c0291d55487,
type: 3}

View file

@ -10,6 +10,7 @@ GameObject:
m_Component:
- component: {fileID: 2935319493830293414}
- component: {fileID: 2935319493830293413}
- component: {fileID: -5893075763862095451}
m_Layer: 0
m_Name: Player
m_TagString: Player
@ -24,10 +25,11 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2935319493830293412}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Children:
- {fileID: 2894367173346332699}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -43,7 +45,131 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4de6b97c3d785d146a0df2c1c078fe91, type: 3}
m_Name:
m_EditorClassIdentifier:
exp: 0
level: 0
hpMax: 0
hp: 0
sprite: {fileID: 21300000, guid: fe9c8eab186d5004eaad446d8e220800, type: 3}
exp: 0
level: 0
--- !u!212 &-5893075763862095451
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2935319493830293412}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -522733599
m_SortingLayer: 1
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: fe9c8eab186d5004eaad446d8e220800, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !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}

114
Assets/Prefabs/Slime.prefab Normal file
View file

@ -0,0 +1,114 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1164136568549368904
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2043533519980591455}
- component: {fileID: 7440667849060313208}
- component: {fileID: 571363246873614695}
- component: {fileID: 1351652798109185028}
m_Layer: 0
m_Name: Slime
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2043533519980591455
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1164136568549368904}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
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!114 &7440667849060313208
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: a72ad0eb2136f284bab78f19fa561bb8, type: 3}
m_Name:
m_EditorClassIdentifier:
hpMax: 0
hp: 0
sprite: {fileID: 21300000, guid: 0121970e693ee0a4d987bd5fe694ad67, type: 3}
--- !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: 0
hp: 0
sprite: {fileID: 21300000, guid: 0121970e693ee0a4d987bd5fe694ad67, type: 3}
visionRange: 4
--- !u!212 &1351652798109185028
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1164136568549368904}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: -522733599
m_SortingLayer: 1
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 0121970e693ee0a4d987bd5fe694ad67, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0

View file

@ -45,6 +45,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
walkable: 0
roomPart: 0
sprite: {fileID: 0}
--- !u!212 &1691311275711631131
SpriteRenderer:
@ -80,8 +81,8 @@ SpriteRenderer:
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingLayerID: -23662865
m_SortingLayer: -1
m_SortingOrder: 0
m_Sprite: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}

View file

@ -120,224 +120,72 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &1386694424
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1386694427}
- component: {fileID: 1386694426}
- component: {fileID: 1386694425}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1386694425
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1386694424}
m_Enabled: 1
--- !u!20 &1386694426
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1386694424}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, 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: 5
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!4 &1386694427
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1386694424}
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!1001 &1591665583
--- !u!1001 &3195245191303068541
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2866215097817665852, guid: 4c25f33cb89f6624db48fc49d353a7f2,
- target: {fileID: 1792584738874209504, guid: 4c25f33cb89f6624db48fc49d353a7f2,
type: 3}
propertyPath: m_Name
value: GameController
objectReference: {fileID: 0}
- target: {fileID: 3211721187637284538, guid: 4c25f33cb89f6624db48fc49d353a7f2,
- target: {fileID: 1419775483983031142, guid: 4c25f33cb89f6624db48fc49d353a7f2,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3211721187637284538, guid: 4c25f33cb89f6624db48fc49d353a7f2,
- target: {fileID: 1419775483983031142, guid: 4c25f33cb89f6624db48fc49d353a7f2,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3211721187637284538, guid: 4c25f33cb89f6624db48fc49d353a7f2,
- target: {fileID: 1419775483983031142, guid: 4c25f33cb89f6624db48fc49d353a7f2,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3211721187637284538, guid: 4c25f33cb89f6624db48fc49d353a7f2,
- target: {fileID: 1419775483983031142, guid: 4c25f33cb89f6624db48fc49d353a7f2,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3211721187637284538, guid: 4c25f33cb89f6624db48fc49d353a7f2,
- target: {fileID: 1419775483983031142, guid: 4c25f33cb89f6624db48fc49d353a7f2,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3211721187637284538, guid: 4c25f33cb89f6624db48fc49d353a7f2,
- target: {fileID: 1419775483983031142, guid: 4c25f33cb89f6624db48fc49d353a7f2,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3211721187637284538, guid: 4c25f33cb89f6624db48fc49d353a7f2,
- target: {fileID: 1419775483983031142, guid: 4c25f33cb89f6624db48fc49d353a7f2,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3211721187637284538, guid: 4c25f33cb89f6624db48fc49d353a7f2,
- target: {fileID: 1419775483983031142, guid: 4c25f33cb89f6624db48fc49d353a7f2,
type: 3}
propertyPath: m_RootOrder
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3211721187637284538, guid: 4c25f33cb89f6624db48fc49d353a7f2,
- target: {fileID: 1419775483983031142, guid: 4c25f33cb89f6624db48fc49d353a7f2,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3211721187637284538, guid: 4c25f33cb89f6624db48fc49d353a7f2,
- target: {fileID: 1419775483983031142, guid: 4c25f33cb89f6624db48fc49d353a7f2,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3211721187637284538, guid: 4c25f33cb89f6624db48fc49d353a7f2,
- target: {fileID: 1419775483983031142, guid: 4c25f33cb89f6624db48fc49d353a7f2,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4c25f33cb89f6624db48fc49d353a7f2, type: 3}
--- !u!1001 &7249059666254997933
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 7249059666095778526, guid: cd714ea41cb7c454994bf0f5ad99abd1,
type: 3}
propertyPath: m_Name
value: Map
objectReference: {fileID: 0}
- target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1,
type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7249059666095778521, guid: cd714ea41cb7c454994bf0f5ad99abd1,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: cd714ea41cb7c454994bf0f5ad99abd1, type: 3}

10
Assets/Scripts/AI.cs Normal file
View file

@ -0,0 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AI : Entity
{
public virtual void OnTurn(){
Debug.LogWarning("OnTurn() not overridden");
}
}

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: db5a27c0009da214088bb4a3c08b76db
guid: e694420377849854db7a2686ff36420c
MonoImporter:
externalObjects: {}
serializedVersion: 2

44
Assets/Scripts/AISlime.cs Normal file
View file

@ -0,0 +1,44 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AISlime : AI
{
public float visionRange = 4;
protected Player player;
protected new void Start() {
base.Start();
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
}
public override void OnTurn(){
if (CanSeePlayer()){
//TODO
}
else {
int direction = Random.Range(0, 4);
if (direction == 0 && map.CanMoveTo(MapPosition + Vector2Int.left)){
transform.Translate(Vector3.left);
}
else if (direction == 1 && map.CanMoveTo(MapPosition + Vector2Int.right)){
transform.Translate(Vector3.right);
}
else if (direction == 2 && map.CanMoveTo(MapPosition + Vector2Int.up)){
transform.Translate(Vector3.up);
}
else if (direction == 3 && map.CanMoveTo(MapPosition + Vector2Int.down)){
transform.Translate(Vector3.down);
}
}
}
public bool CanSeePlayer(){
return Vector3.Distance(player.transform.position, transform.position) < visionRange;
}
private void OnDrawGizmosSelected() {
Gizmos.color = Color.cyan;
Gizmos.DrawWireSphere(transform.position, visionRange);
}
}

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 49be0f8468bff6249b7befdf02bc8ec9
guid: 2fcfe4b94620b234fb7a294bf4453a69
MonoImporter:
externalObjects: {}
serializedVersion: 2

View file

@ -1,34 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/*
public class Consumabile : Object
{
// Start is called before the first frame update
public enum Tipo {Cura, Danno};
public GameObject player;
public Player player;
public int valore;
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void use(){
if (Tipo == Tipo.Cura){
player.hp += valore;
if (player.hp >= player.maxhp) player.hp = player.maxhp;
}
if (Tipo == Tipo.Danno){
player.hp -= valore;
}
}
}
*/

35
Assets/Scripts/Entity.cs Normal file
View file

@ -0,0 +1,35 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Entity : MonoBehaviour
{
public int hpMax;
[AfterStartAttribute]
public int hp;
[BeforeStartAttribute]
public Sprite sprite;
public Vector2Int MapPosition {
get {
return new Vector2Int((int)transform.position.x, (int)transform.position.y);
}
}
protected GameObject gameController;
protected SpriteRenderer spriteRenderer;
protected TurnHandler turnHandler;
protected Map map;
protected void Start()
{
spriteRenderer = GetComponent<SpriteRenderer>();
spriteRenderer.sprite = sprite;
gameController = GameObject.FindGameObjectWithTag("GameController");
turnHandler = gameController.GetComponentInChildren<TurnHandler>();
map = gameController.GetComponentInChildren<Map>();
hp = hpMax;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 09a0fcf071a3b6244b6339cd122566fe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -96,22 +96,32 @@ public class Map : MonoBehaviour
[BeforeStartAttribute]
public GameObject tilePrefab;
[BeforeStartAttribute]
public GameObject playerPrefab;
[BeforeStartAttribute]
public List<GameObject> enemyPrefabs;
[BeforeStartAttribute]
public int enemiesToSpawn = 10;
private GameObject[,] tiles;
private List<MapRoom> rooms;
private System.Random rnd;
private TurnHandler turnHandler;
public Tile GetTile(Vector2Int position) {
GameObject tileObject = tiles[position.x, position.y];
Tile tile = tileObject.GetComponent<Tile>();
return tile;
return tileObject.GetComponent<Tile>();
}
public bool CanMoveTo(Vector2Int direction)
public bool CanMoveTo(Vector2Int position)
{
try {
return GetTile(direction).walkable;
bool walkable = GetTile(position).walkable;
bool free = !(bool)turnHandler.GetEntityAtPosition(position);
return walkable && free;
}
catch(System.ArgumentOutOfRangeException) {
catch(System.IndexOutOfRangeException) {
return false;
}
}
@ -212,6 +222,25 @@ public class Map : MonoBehaviour
}
}
private void PlacePlayer() {
MapRoom room = rooms[Random.Range(0, rooms.Count)];
Vector2Int point = room.RandomPoint();
GameObject playerObject = Instantiate(playerPrefab, turnHandler.transform);
playerObject.name = "Player";
playerObject.transform.position = new Vector3(point.x, point.y, 0);
}
private void PlaceEnemies() {
for(int i = 0; i < enemiesToSpawn; i++) {
MapRoom room = rooms[Random.Range(0, rooms.Count)];
Vector2Int point = room.RandomPoint();
GameObject enemyPrefab = enemyPrefabs[Random.Range(0, enemyPrefabs.Count)];
GameObject enemyObject = Instantiate(enemyPrefab, turnHandler.transform);
enemyObject.name = "Enemy " + i.ToString();
enemyObject.transform.position = new Vector3(point.x, point.y, 0);
}
}
private Sprite GetFloorTileSprite() {
return floorSprites[Random.Range(0, floorSprites.Count)];
}
@ -221,8 +250,10 @@ public class Map : MonoBehaviour
//Initialize everything
tiles = new GameObject[mapSize, mapSize];
rooms = new List<MapRoom>();
rnd = new System.Random();
//Generate the map
turnHandler = GameObject.FindGameObjectWithTag("GameController").GetComponentInChildren<TurnHandler>();
GenerateMap();
PlacePlayer();
PlaceEnemies();
}
}

View file

@ -8,7 +8,7 @@ MonoImporter:
- roomSprite: {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- corridorSprite: {fileID: 21300000, guid: e0e60c9a4ff0b8e429e6cfe316da9bbf, type: 3}
- tilePrefab: {instanceID: 0}
executionOrder: 0
executionOrder: -50
icon: {instanceID: 0}
userData:
assetBundleName:

View file

@ -5,54 +5,19 @@ using UnityEngine;
public class Monster : MonoBehaviour
{
public int hpMax;
[AfterStartAttribute]
public int hp;
public bool isUndead;
public int movesPerTurn;
public bool hasSpottedPlayer;
[BeforeStartAttribute]
public Sprite sprite;
private Map map;
private SpriteRenderer spriteRenderer;
private Player player;
// Start is called before the first frame update
private void Start()
{
map = GameObject.FindGameObjectWithTag("Map").GetComponent<Map>();
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
hasSpottedPlayer = false;
}
void Turn(){
IsPlayerNear();
if (!hasSpottedPlayer){
int direction = Random.Range(0, 4);
if (direction == 0 && map.CanMoveTo(Vector2Int.left)){
transform.Translate(Vector3.left);
}
else if (direction == 1 && map.CanMoveTo(Vector2Int.right)){
transform.Translate(Vector3.right);
}
else if (direction == 2 && map.CanMoveTo(Vector2Int.up)){
transform.Translate(Vector3.up);
}
else if (direction == 3 && map.CanMoveTo(Vector2Int.left)){
transform.Translate(Vector3.left);
}
}
else{
//Put here pathfinding code
}
}
void IsPlayerNear(){
if ((player.transform.position.x-transform.position.x)<=3 || (transform.position.x-player.transform.position.x)>=-3){
hasSpottedPlayer=true;
}
if ((player.transform.position.y-transform.position.y)<=3 || (transform.position.y-player.transform.position.y)>=-3){
hasSpottedPlayer=true;
}
spriteRenderer = GetComponent<SpriteRenderer>();
spriteRenderer.sprite = sprite;
hp = hpMax;
}
}

View file

@ -1,20 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Object : MonoBehaviour
{
public string nome;
public int costo;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View file

@ -2,24 +2,10 @@
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
public class Player : Entity
{
public int exp;
public int level;
public int hpMax;
[AfterStartAttribute]
public int hp;
private Map map;
private GameObject gameController;
void Start()
{
map = GameObject.FindGameObjectWithTag("Map").GetComponent<Map>();
gameController = GameObject.FindGameObjectWithTag("GameController");
hp = hpMax;
}
void Update()
{
@ -29,39 +15,36 @@ public class Player : MonoBehaviour
void CheckForMovementInput()
{
bool hasMoved = false;
Vector2Int posizione = new Vector2Int();
posizione.x = (int)transform.position.x+1;
posizione.y = (int)transform.position.y+1;
if (Input.GetKeyDown(KeyCode.A))
{
if (map.CanMoveTo(posizione + Vector2Int.left)) {
if (map.CanMoveTo(MapPosition + Vector2Int.left)) {
transform.Translate(Vector3.left);
hasMoved = true;
}
}
else if (Input.GetKeyDown(KeyCode.D))
{
if (map.CanMoveTo(posizione + Vector2Int.right)) {
if (map.CanMoveTo(MapPosition + Vector2Int.right)) {
transform.Translate(Vector3.right);
hasMoved = true;
}
}
else if (Input.GetKeyDown(KeyCode.W))
{
if (map.CanMoveTo(posizione + Vector2Int.up)) {
if (map.CanMoveTo(MapPosition + Vector2Int.up)) {
transform.Translate(Vector3.up);
hasMoved = true;
}
}
else if (Input.GetKeyDown(KeyCode.S))
{
if (map.CanMoveTo(posizione + Vector2Int.down)) {
if (map.CanMoveTo(MapPosition + Vector2Int.down)) {
transform.Translate(Vector3.down);
hasMoved = true;
}
}
if(hasMoved) {
gameController.BroadcastMessage("Turn");
turnHandler.OnTurn();
}
}
}

View file

@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TurnHandler : MonoBehaviour
{
public void OnTurn() {
AI[] ais = gameObject.GetComponentsInChildren<AI>();
foreach(AI ai in ais) {
ai.OnTurn();
}
}
public Entity GetEntityAtPosition(Vector2Int position) {
Entity[] entities = GetComponentsInChildren<Entity>();
foreach(Entity entity in entities) {
if(entity.MapPosition == position) {
return entity;
}
}
return null;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2447171af2ad9634498f2d769d7f5200
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -3,8 +3,7 @@
--- !u!78 &1
TagManager:
serializedVersion: 2
tags:
- Map
tags: []
layers:
- Default
- TransparentFX
@ -39,6 +38,12 @@ TagManager:
-
-
m_SortingLayers:
- name: Tiles
uniqueID: 4271304431
locked: 0
- name: Default
uniqueID: 0
locked: 0
- name: Entities
uniqueID: 3772233697
locked: 0