Pull request #39: global config file
Merge in CGD/gather-and-defend from feature/globalConfigFile to main * commit '0714036b57f45e2c04dc8de469ce99b1b8a2d6d3': separate ally and enemy config + bugfixes appliquer global config aux différents endroits forgot changes in game.unity creer le scriptable object GlobalConfig
This commit is contained in:
commit
ce058aee7f
30
Assets/GlobalConfig.asset
Normal file
30
Assets/GlobalConfig.asset
Normal file
@ -0,0 +1,30 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 32e788fd2a7bdaf4ab145b64231cb833, type: 3}
|
||||
m_Name: GlobalConfig
|
||||
m_EditorClassIdentifier:
|
||||
damageFlashIntensity: 1
|
||||
enemySpeedMultiplier: 1
|
||||
enemyDamageMultiplier: 1
|
||||
enemyLifeMultiplier: 1
|
||||
enemyRangeMultiplier: {x: 1, y: 1}
|
||||
enemyAttackSpeedMultiplier: 1
|
||||
allyDamageMultiplier: 1
|
||||
allyLifeMultiplier: 1
|
||||
allyAttackSpeedMultiplier: 0.5
|
||||
allySpeedMultiplier: 1
|
||||
allyRangeMultiplier: {x: 1, y: 1}
|
||||
harvestDuration: 5
|
||||
harvestAmount: 10
|
||||
useRandomHarvestDuration: 0
|
||||
randomHarvestDurationMinimum: 0
|
||||
randomHarvestDurationMaximum: 0
|
||||
8
Assets/GlobalConfig.asset.meta
Normal file
8
Assets/GlobalConfig.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 132e291fc51a8f445b1183b11a5d6b39
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -12,6 +12,7 @@ GameObject:
|
||||
- component: {fileID: 3028288566889208750}
|
||||
- component: {fileID: 3028288566889208749}
|
||||
- component: {fileID: -245230096461627285}
|
||||
- component: {fileID: 5626804684391367242}
|
||||
m_Layer: 0
|
||||
m_Name: LevelManager
|
||||
m_TagString: Untagged
|
||||
@ -119,3 +120,16 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 37c0aa967043d974783120d6ea9b136c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!114 &5626804684391367242
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3028288566889208744}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c8f878516c4a3324aa1a9672f8b336c9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_current: {fileID: 11400000, guid: 132e291fc51a8f445b1183b11a5d6b39, type: 2}
|
||||
|
||||
@ -9,7 +9,6 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 80204295746100151}
|
||||
- component: {fileID: 3889963999147056896}
|
||||
- component: {fileID: 788547799086903831}
|
||||
- component: {fileID: 8565800310011739221}
|
||||
- component: {fileID: 313037212318601125}
|
||||
@ -37,44 +36,6 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1839735485 &3889963999147056896
|
||||
Tilemap:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 80204295746100150}
|
||||
m_Enabled: 0
|
||||
m_Tiles: {}
|
||||
m_AnimatedTiles: {}
|
||||
m_TileAssetArray: []
|
||||
m_TileSpriteArray: []
|
||||
m_TileMatrixArray: []
|
||||
m_TileColorArray: []
|
||||
m_TileObjectToInstantiateArray: []
|
||||
m_AnimationFrameRate: 1
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Origin: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 0, y: 0, z: 1}
|
||||
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
|
||||
m_TileOrientation: 0
|
||||
m_TileOrientationMatrix:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
--- !u!50 &788547799086903831
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
@ -137,7 +98,7 @@ MonoBehaviour:
|
||||
_hp: 20
|
||||
_speed: 0.12
|
||||
_attack_damage: 2
|
||||
_attack_speed: 2
|
||||
_attack_interval: 2
|
||||
--- !u!1 &381864779947488822
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -1,77 +1,5 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &270769315063318434
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 71124047072817123}
|
||||
- component: {fileID: 2608989659328117942}
|
||||
- component: {fileID: 3358069652062874313}
|
||||
m_Layer: 0
|
||||
m_Name: detection
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &71124047072817123
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 270769315063318434}
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6962989255644195631}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!61 &2608989659328117942
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 270769315063318434}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 1
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0.5, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0, y: 0}
|
||||
oldSize: {x: 0, y: 0}
|
||||
newSize: {x: 0, y: 0}
|
||||
adaptiveTilingThreshold: 0
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 0.5, y: 0.5}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!114 &3358069652062874313
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 270769315063318434}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 531d7966d86bd0c4d83baf58bcb56cd5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_entityLinked: {fileID: 0}
|
||||
--- !u!1 &6962989255035248094
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -397,7 +325,6 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6962989255644195631}
|
||||
- component: {fileID: 6072713849781841816}
|
||||
- component: {fileID: -1491803373025033585}
|
||||
- component: {fileID: -7538281095464317747}
|
||||
- component: {fileID: -7651792297317791922}
|
||||
@ -422,48 +349,9 @@ Transform:
|
||||
m_Children:
|
||||
- {fileID: 6962989256011107500}
|
||||
- {fileID: 6962989255883535387}
|
||||
- {fileID: 71124047072817123}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1839735485 &6072713849781841816
|
||||
Tilemap:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6962989255644195630}
|
||||
m_Enabled: 0
|
||||
m_Tiles: {}
|
||||
m_AnimatedTiles: {}
|
||||
m_TileAssetArray: []
|
||||
m_TileSpriteArray: []
|
||||
m_TileMatrixArray: []
|
||||
m_TileColorArray: []
|
||||
m_TileObjectToInstantiateArray: []
|
||||
m_AnimationFrameRate: 1
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Origin: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 0, y: 0, z: 1}
|
||||
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
|
||||
m_TileOrientation: 0
|
||||
m_TileOrientationMatrix:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
--- !u!50 &-1491803373025033585
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
@ -526,7 +414,7 @@ MonoBehaviour:
|
||||
_hp: 0
|
||||
_speed: 0
|
||||
_attack_damage: 0
|
||||
_attack_speed: 0
|
||||
_attack_interval: 0
|
||||
_harvesterResourcePairs:
|
||||
- _harvesterPrefab: {fileID: 5157279992115123224, guid: 85534a2d6c2add54d864073914646192, type: 3}
|
||||
_resource: 2
|
||||
|
||||
@ -1,77 +1,5 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &270769315063318434
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 71124047072817123}
|
||||
- component: {fileID: 2608989659328117942}
|
||||
- component: {fileID: 3358069652062874313}
|
||||
m_Layer: 0
|
||||
m_Name: detection
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &71124047072817123
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 270769315063318434}
|
||||
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_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6962989255644195631}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!61 &2608989659328117942
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 270769315063318434}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 1
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0.5, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0, y: 0}
|
||||
oldSize: {x: 0, y: 0}
|
||||
newSize: {x: 0, y: 0}
|
||||
adaptiveTilingThreshold: 0
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 0.5, y: 0.5}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!114 &3358069652062874313
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 270769315063318434}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 531d7966d86bd0c4d83baf58bcb56cd5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_entityLinked: {fileID: 0}
|
||||
--- !u!1 &6962989255035248094
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -397,7 +325,6 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6962989255644195631}
|
||||
- component: {fileID: 6072713849781841816}
|
||||
- component: {fileID: -1491803373025033585}
|
||||
- component: {fileID: -7538281095464317747}
|
||||
- component: {fileID: 6812572548963698156}
|
||||
@ -422,48 +349,9 @@ Transform:
|
||||
m_Children:
|
||||
- {fileID: 6962989256011107500}
|
||||
- {fileID: 6962989255883535387}
|
||||
- {fileID: 71124047072817123}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1839735485 &6072713849781841816
|
||||
Tilemap:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6962989255644195630}
|
||||
m_Enabled: 0
|
||||
m_Tiles: {}
|
||||
m_AnimatedTiles: {}
|
||||
m_TileAssetArray: []
|
||||
m_TileSpriteArray: []
|
||||
m_TileMatrixArray: []
|
||||
m_TileColorArray: []
|
||||
m_TileObjectToInstantiateArray: []
|
||||
m_AnimationFrameRate: 1
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Origin: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 0, y: 0, z: 1}
|
||||
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
|
||||
m_TileOrientation: 0
|
||||
m_TileOrientationMatrix:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
--- !u!50 &-1491803373025033585
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
@ -526,7 +414,7 @@ MonoBehaviour:
|
||||
_hp: 0
|
||||
_speed: 0
|
||||
_attack_damage: 0
|
||||
_attack_speed: 0
|
||||
_attack_interval: 0
|
||||
_harvesterResourcePairs:
|
||||
- _harvesterPrefab: {fileID: 5157279992115123224, guid: 85534a2d6c2add54d864073914646192, type: 3}
|
||||
_resource: 2
|
||||
|
||||
@ -545,7 +545,6 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5531237550998824025}
|
||||
- component: {fileID: 8657602915366199534}
|
||||
- component: {fileID: 5129435415547448825}
|
||||
- component: {fileID: 4251894621246849979}
|
||||
- component: {fileID: 9177659942431061517}
|
||||
@ -574,44 +573,6 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1839735485 &8657602915366199534
|
||||
Tilemap:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5531237550998824024}
|
||||
m_Enabled: 0
|
||||
m_Tiles: {}
|
||||
m_AnimatedTiles: {}
|
||||
m_TileAssetArray: []
|
||||
m_TileSpriteArray: []
|
||||
m_TileMatrixArray: []
|
||||
m_TileColorArray: []
|
||||
m_TileObjectToInstantiateArray: []
|
||||
m_AnimationFrameRate: 1
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Origin: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 0, y: 0, z: 1}
|
||||
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
|
||||
m_TileOrientation: 0
|
||||
m_TileOrientationMatrix:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
--- !u!50 &5129435415547448825
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
@ -674,7 +635,7 @@ MonoBehaviour:
|
||||
_hp: 10
|
||||
_speed: 0
|
||||
_attack_damage: 2
|
||||
_attack_speed: 2
|
||||
_attack_interval: 2
|
||||
--- !u!1 &6125909153338481476
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -398,7 +398,6 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 6962989255644195631}
|
||||
- component: {fileID: 8585520847943034727}
|
||||
- component: {fileID: 6072713849781841816}
|
||||
- component: {fileID: -1491803373025033585}
|
||||
- component: {fileID: -7538281095464317747}
|
||||
m_Layer: 0
|
||||
@ -440,46 +439,8 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
_hp: 100
|
||||
_speed: 0
|
||||
_attack_damage: 1
|
||||
_attack_speed: 1.2
|
||||
--- !u!1839735485 &6072713849781841816
|
||||
Tilemap:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6962989255644195630}
|
||||
m_Enabled: 0
|
||||
m_Tiles: {}
|
||||
m_AnimatedTiles: {}
|
||||
m_TileAssetArray: []
|
||||
m_TileSpriteArray: []
|
||||
m_TileMatrixArray: []
|
||||
m_TileColorArray: []
|
||||
m_TileObjectToInstantiateArray: []
|
||||
m_AnimationFrameRate: 1
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Origin: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 0, y: 0, z: 1}
|
||||
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
|
||||
m_TileOrientation: 0
|
||||
m_TileOrientationMatrix:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
_attack_damage: 0
|
||||
_attack_interval: 0
|
||||
--- !u!50 &-1491803373025033585
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
|
||||
@ -1063,7 +1063,6 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 6962989255644195631}
|
||||
- component: {fileID: 8585520847943034727}
|
||||
- component: {fileID: 6072713849781841816}
|
||||
- component: {fileID: -1491803373025033585}
|
||||
- component: {fileID: -7538281095464317747}
|
||||
m_Layer: 0
|
||||
@ -1106,45 +1105,7 @@ MonoBehaviour:
|
||||
_hp: 10
|
||||
_speed: 0
|
||||
_attack_damage: 2
|
||||
_attack_speed: 2
|
||||
--- !u!1839735485 &6072713849781841816
|
||||
Tilemap:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6962989255644195630}
|
||||
m_Enabled: 0
|
||||
m_Tiles: {}
|
||||
m_AnimatedTiles: {}
|
||||
m_TileAssetArray: []
|
||||
m_TileSpriteArray: []
|
||||
m_TileMatrixArray: []
|
||||
m_TileColorArray: []
|
||||
m_TileObjectToInstantiateArray: []
|
||||
m_AnimationFrameRate: 1
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Origin: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 0, y: 0, z: 1}
|
||||
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
|
||||
m_TileOrientation: 0
|
||||
m_TileOrientationMatrix:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
_attack_interval: 2
|
||||
--- !u!50 &-1491803373025033585
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
|
||||
@ -9,7 +9,6 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6962989255644195631}
|
||||
- component: {fileID: 6072713849781841816}
|
||||
- component: {fileID: -1491803373025033585}
|
||||
- component: {fileID: 8133954670424616578}
|
||||
m_Layer: 0
|
||||
@ -36,44 +35,6 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1839735485 &6072713849781841816
|
||||
Tilemap:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6962989255644195630}
|
||||
m_Enabled: 0
|
||||
m_Tiles: {}
|
||||
m_AnimatedTiles: {}
|
||||
m_TileAssetArray: []
|
||||
m_TileSpriteArray: []
|
||||
m_TileMatrixArray: []
|
||||
m_TileColorArray: []
|
||||
m_TileObjectToInstantiateArray: []
|
||||
m_AnimationFrameRate: 1
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Origin: {x: 0, y: 0, z: 0}
|
||||
m_Size: {x: 0, y: 0, z: 1}
|
||||
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
|
||||
m_TileOrientation: 0
|
||||
m_TileOrientationMatrix:
|
||||
e00: 1
|
||||
e01: 0
|
||||
e02: 0
|
||||
e03: 0
|
||||
e10: 0
|
||||
e11: 1
|
||||
e12: 0
|
||||
e13: 0
|
||||
e20: 0
|
||||
e21: 0
|
||||
e22: 1
|
||||
e23: 0
|
||||
e30: 0
|
||||
e31: 0
|
||||
e32: 0
|
||||
e33: 1
|
||||
--- !u!50 &-1491803373025033585
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
|
||||
@ -4,14 +4,20 @@ using UnityEngine;
|
||||
|
||||
public class Ally : Entity
|
||||
{
|
||||
public override float DamageMultiplier => GlobalConfig.Instance.Current.allyDamageMultiplier;
|
||||
public override float AttackSpeedMultiplier => GlobalConfig.Instance.Current.allyAttackSpeedMultiplier;
|
||||
public override float HpMultiplier => GlobalConfig.Instance.Current.allyLifeMultiplier;
|
||||
public override Vector2 RangeMultiplier => GlobalConfig.Instance.Current.allyRangeMultiplier;
|
||||
public override float SpeedMultiplier => GlobalConfig.Instance.Current.allySpeedMultiplier;
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
base.Start();
|
||||
}
|
||||
|
||||
void Update()
|
||||
public override void Update()
|
||||
{
|
||||
|
||||
base.Update();
|
||||
if(IsEnemyDetected) {
|
||||
AttackEnemy();
|
||||
}
|
||||
@ -21,14 +27,15 @@ public class Ally : Entity
|
||||
void AttackEnemy()
|
||||
{
|
||||
//Attack Cooldown
|
||||
if(AttackSpeed < AttackSpeedWait) {
|
||||
if (AttackSpeedWait > AttackInterval)
|
||||
{
|
||||
|
||||
Animation.PlayAttackAnim();
|
||||
Animation.PlayAttackAnim();
|
||||
|
||||
AttackSpeedWait = 0f;
|
||||
}
|
||||
AttackSpeedWait = 0f;
|
||||
}
|
||||
|
||||
AttackSpeedWait += Time.deltaTime;
|
||||
AttackSpeedWait += Time.deltaTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -10,9 +10,9 @@ public class Archer : Ally
|
||||
base.Start();
|
||||
}
|
||||
|
||||
void Update()
|
||||
public override void Update()
|
||||
{
|
||||
|
||||
base.Update();
|
||||
if(IsEnemyDetected) {
|
||||
AttackEnemy();
|
||||
}
|
||||
@ -23,7 +23,7 @@ public class Archer : Ally
|
||||
{
|
||||
|
||||
//Attack Cooldown
|
||||
if(AttackSpeed < AttackSpeedWait) {
|
||||
if(AttackInterval < AttackSpeedWait) {
|
||||
|
||||
Animation.PlayAttackAnim();
|
||||
|
||||
|
||||
@ -4,9 +4,20 @@ using static Enum;
|
||||
|
||||
public class Harvester : Entity
|
||||
{
|
||||
[SerializeField][Tooltip("helps choose the right skin for the harvester depending on resource")]
|
||||
[SerializeField] [Tooltip("helps choose the right skin for the harvester depending on resource")]
|
||||
private List<HarvesterResourcePair> _harvesterResourcePairs;
|
||||
protected ResourceChoice ResourceChoice => _resourceChoice;
|
||||
|
||||
public override Vector2 RangeMultiplier { get; }
|
||||
|
||||
public override float HpMultiplier { get; }
|
||||
|
||||
public override float SpeedMultiplier { get; }
|
||||
|
||||
public override float DamageMultiplier { get; }
|
||||
|
||||
public override float AttackSpeedMultiplier { get; }
|
||||
|
||||
[SerializeField]
|
||||
private ResourceChoice _resourceChoice;
|
||||
public override sealed void Start()
|
||||
|
||||
@ -4,6 +4,14 @@ using UnityEngine;
|
||||
|
||||
public class AnimationEntity : MonoBehaviour
|
||||
{
|
||||
enum EntityAnimationState
|
||||
{
|
||||
Idle = 0,
|
||||
Walking = 1,
|
||||
Attacking = 2,
|
||||
Dying = 3
|
||||
}
|
||||
private EntityAnimationState entityState;
|
||||
|
||||
private Animator _animatorEntity;
|
||||
private bool _doSomething = false;
|
||||
@ -12,31 +20,47 @@ public class AnimationEntity : MonoBehaviour
|
||||
|
||||
void Start()
|
||||
{
|
||||
AttackSpeedMultiplier = 10;
|
||||
SpeedMultiplier = 10;
|
||||
_animatorEntity = GetComponentInChildren<Animator>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (_doSomething && _animatorEntity.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1f)
|
||||
{
|
||||
PlayIdleAnim();
|
||||
_doSomething = false;
|
||||
_isWalking = false;
|
||||
}
|
||||
_animatorEntity.speed = GetAnimatorSpeed();
|
||||
}
|
||||
|
||||
private float GetAnimatorSpeed()
|
||||
{
|
||||
return entityState switch
|
||||
{
|
||||
EntityAnimationState.Attacking => AttackSpeedMultiplier,
|
||||
EntityAnimationState.Walking => SpeedMultiplier,
|
||||
_ => 1,
|
||||
};
|
||||
}
|
||||
|
||||
public void PlayIdleAnim()
|
||||
{
|
||||
if(!_isDead) {
|
||||
_animatorEntity.speed = 1;
|
||||
_animatorEntity.Play("idle", 0, 0f);
|
||||
entityState = EntityAnimationState.Idle;
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayWalkAnim()
|
||||
{
|
||||
if(!_isDead) {
|
||||
_animatorEntity.speed = SpeedMultiplier;
|
||||
_animatorEntity.Play("walk", 0, 0f);
|
||||
entityState = EntityAnimationState.Walking;
|
||||
_isWalking = true;
|
||||
}
|
||||
}
|
||||
@ -44,14 +68,18 @@ public class AnimationEntity : MonoBehaviour
|
||||
public void PlayAttackAnim()
|
||||
{
|
||||
if(!_isDead) {
|
||||
_animatorEntity.speed = AttackSpeedMultiplier;
|
||||
_animatorEntity.Play("attack", 0, 0f);
|
||||
entityState = EntityAnimationState.Attacking;
|
||||
_doSomething = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayDieAnim()
|
||||
{
|
||||
_animatorEntity.speed = 1;
|
||||
_animatorEntity.Play("die", 0, 0f);
|
||||
entityState = EntityAnimationState.Dying;
|
||||
_doSomething = true;
|
||||
_isDead = true;
|
||||
}
|
||||
@ -62,5 +90,12 @@ public class AnimationEntity : MonoBehaviour
|
||||
get { return _isWalking; }
|
||||
set { _isWalking = value; }
|
||||
}
|
||||
|
||||
public float AttackSpeedMultiplier
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public float SpeedMultiplier
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,22 +4,48 @@ using UnityEngine;
|
||||
|
||||
public class Detection : MonoBehaviour
|
||||
{
|
||||
private Vector2 detectionRange;
|
||||
private BoxCollider2D _collider;
|
||||
public Rect DetectionRectangle
|
||||
{
|
||||
get
|
||||
{
|
||||
var collider = GetComponent<Collider2D>();
|
||||
var bounds = collider.bounds;
|
||||
if (!_collider) _collider = GetComponent<BoxCollider2D>();
|
||||
var bounds = _collider.bounds;
|
||||
return new Rect(bounds.min - transform.position, bounds.size);
|
||||
}
|
||||
}
|
||||
[SerializeField]
|
||||
private Entity _entityLinked;
|
||||
protected virtual void Start()
|
||||
{
|
||||
_collider = GetComponent<BoxCollider2D>();
|
||||
detectionRange = _collider.size;
|
||||
}
|
||||
void ResizeCollider()
|
||||
{
|
||||
if (!EntityLinked) return;
|
||||
var multiplier = EntityLinked.RangeMultiplier;
|
||||
var size = _collider.size;
|
||||
size.x = detectionRange.x * multiplier.x;
|
||||
size.y = detectionRange.y * multiplier.y;
|
||||
_collider.size = size;
|
||||
|
||||
var offset = _collider.offset;
|
||||
if (offset == Vector2.zero) return;
|
||||
|
||||
offset.x = Mathf.Sign(offset.x) * size.x / 2;
|
||||
_collider.offset = offset;
|
||||
}
|
||||
//If it's a projectile damage > 0
|
||||
private int _projectileDamage = 0;
|
||||
private float _distanceMin = 100f;
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
ResizeCollider();
|
||||
}
|
||||
|
||||
void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
//Projectiles detection + damage deal
|
||||
@ -82,6 +108,7 @@ public class Detection : MonoBehaviour
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Getter and Setter
|
||||
public Entity EntityLinked
|
||||
{
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using static Extensions;
|
||||
|
||||
public class Entity : LevelObject
|
||||
public abstract class Entity : LevelObject
|
||||
{
|
||||
//Attribut
|
||||
[SerializeField]
|
||||
@ -11,9 +10,9 @@ public class Entity : LevelObject
|
||||
[SerializeField]
|
||||
private float _speed;
|
||||
[SerializeField]
|
||||
private int _attack_damage;
|
||||
private int _attack_damage = 2;
|
||||
[SerializeField]
|
||||
private float _attack_speed;
|
||||
private float _attack_interval = 2;
|
||||
private float _attack_speed_wait = 0f;
|
||||
private AnimationEntity _animation;
|
||||
private Shader _shaderGUItext;
|
||||
@ -30,7 +29,11 @@ public class Entity : LevelObject
|
||||
_spriteRenderers = GetComponentsInChildren<SpriteRenderer>();
|
||||
Animation = gameObject.AddComponent<AnimationEntity>();
|
||||
}
|
||||
|
||||
public virtual void Update()
|
||||
{
|
||||
Animation.AttackSpeedMultiplier = AttackSpeedMultiplier;
|
||||
Animation.SpeedMultiplier = SpeedMultiplier;
|
||||
}
|
||||
//Start the animation of death and the fading of the entity
|
||||
public void Death()
|
||||
{
|
||||
@ -90,35 +93,25 @@ public class Entity : LevelObject
|
||||
|
||||
//GETTERS AND SETTERS
|
||||
|
||||
public int Hp
|
||||
{
|
||||
get { return _hp; }
|
||||
set { _hp = value; }
|
||||
}
|
||||
public abstract Vector2 RangeMultiplier { get; }
|
||||
public abstract float HpMultiplier { get; }
|
||||
public abstract float SpeedMultiplier { get; }
|
||||
public abstract float DamageMultiplier { get; }
|
||||
public abstract float AttackSpeedMultiplier { get; }
|
||||
|
||||
public float Speed
|
||||
{
|
||||
get { return _speed; }
|
||||
set { _speed = value; }
|
||||
}
|
||||
public int Hp => (int)(_hp * HpMultiplier);
|
||||
|
||||
public int AttackDamage
|
||||
{
|
||||
get { return _attack_damage; }
|
||||
set { _attack_damage = value; }
|
||||
}
|
||||
public float Speed => _speed * SpeedMultiplier;
|
||||
|
||||
public float AttackSpeed
|
||||
{
|
||||
get { return _attack_speed; }
|
||||
set { _attack_speed = value; }
|
||||
}
|
||||
public int AttackDamage => (int)(_attack_damage * DamageMultiplier);
|
||||
|
||||
public float AttackInterval => _attack_interval / AttackSpeedMultiplier;
|
||||
|
||||
public float AttackSpeedWait
|
||||
{
|
||||
get { return _attack_speed_wait; }
|
||||
set { _attack_speed_wait = value; }
|
||||
}
|
||||
{
|
||||
get { return _attack_speed_wait; }
|
||||
set { _attack_speed_wait = value; }
|
||||
}
|
||||
|
||||
public bool IsEnemyDetected
|
||||
{
|
||||
@ -145,19 +138,17 @@ public class Entity : LevelObject
|
||||
&& base.Equals(otherEntity)
|
||||
&& otherEntity._hp == _hp
|
||||
&& otherEntity._speed == _speed
|
||||
&& otherEntity._attack_speed == _attack_speed
|
||||
&& otherEntity._attack_interval == _attack_interval
|
||||
&& otherEntity._attack_damage == _attack_damage;
|
||||
}
|
||||
|
||||
public override Dictionary<string, object> ToDictionary()
|
||||
{
|
||||
var dict = base.ToDictionary();
|
||||
|
||||
dict[nameof(_hp)] = _hp;
|
||||
dict[nameof(_speed)] = _speed;
|
||||
dict[nameof(_attack_speed)] = _attack_speed;
|
||||
dict[nameof(_attack_interval)] = _attack_interval;
|
||||
dict[nameof(_attack_damage)] = _attack_damage;
|
||||
dict[nameof(_attack_speed_wait)] = _attack_speed_wait;
|
||||
|
||||
return dict;
|
||||
}
|
||||
@ -167,9 +158,8 @@ public class Entity : LevelObject
|
||||
|
||||
_hp = dict[nameof(_hp)].ToInt();
|
||||
_speed = dict[nameof(_speed)].ToFloat();
|
||||
_attack_speed = dict[nameof(_attack_speed)].ToFloat();
|
||||
_attack_interval = dict[nameof(_attack_interval)].ToFloat();
|
||||
_attack_damage = dict[nameof(_attack_damage)].ToInt();
|
||||
_attack_speed_wait = dict[nameof(_attack_speed_wait)].ToFloat();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ using BindingFlags = System.Reflection.BindingFlags;
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using GatherAndDefend.LevelEditor;
|
||||
using System.Linq;
|
||||
|
||||
public static class Extensions
|
||||
{
|
||||
@ -96,4 +97,22 @@ public static class Extensions
|
||||
{
|
||||
return Vector2.Distance(vect, tilePosition) < 0.5f;
|
||||
}
|
||||
|
||||
public static T Minimum<T>(this IEnumerable<T> list, Func<T, float> func)
|
||||
{
|
||||
if (list.Count() < 1) throw new Exception("in " + nameof(Minimum) + " : Cannot find minimum of empty list : " + nameof(list));
|
||||
T minT = list.ElementAt(0);
|
||||
float minVal = func(minT);
|
||||
|
||||
foreach (var obj in list)
|
||||
{
|
||||
var newVal = func(obj);
|
||||
if (minVal > newVal)
|
||||
{
|
||||
minT = obj;
|
||||
minVal = newVal;
|
||||
}
|
||||
}
|
||||
return minT;
|
||||
}
|
||||
}
|
||||
18
Assets/Scripts/General/GlobalConfig.cs
Normal file
18
Assets/Scripts/General/GlobalConfig.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GlobalConfig : SingletonBehaviour<GlobalConfig>
|
||||
{
|
||||
[SerializeField]
|
||||
private GlobalConfigFile _current;
|
||||
public GlobalConfigFile Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_current)
|
||||
{
|
||||
_current = ScriptableObject.CreateInstance<GlobalConfigFile>();
|
||||
}
|
||||
return _current;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/General/GlobalConfig.cs.meta
Normal file
11
Assets/Scripts/General/GlobalConfig.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8f878516c4a3324aa1a9672f8b336c9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
33
Assets/Scripts/General/GlobalConfigFile.cs
Normal file
33
Assets/Scripts/General/GlobalConfigFile.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(menuName = project_name + "/Global Config")]
|
||||
public class GlobalConfigFile : ScriptableObject
|
||||
{
|
||||
|
||||
public const string project_name = "Gather And Defend";
|
||||
|
||||
public float damageFlashIntensity = 1;
|
||||
[Header("Enemies")]
|
||||
public float enemySpeedMultiplier = 1;
|
||||
public float enemyDamageMultiplier = 1;
|
||||
public float enemyLifeMultiplier = 1;
|
||||
public Vector2 enemyRangeMultiplier = Vector2.one;
|
||||
public float enemyAttackSpeedMultiplier = 1;
|
||||
|
||||
[Header("Allies")]
|
||||
public float allyDamageMultiplier = 1;
|
||||
public float allyLifeMultiplier = 1;
|
||||
public float allyAttackSpeedMultiplier = 1;
|
||||
public float allySpeedMultiplier = 1;
|
||||
public Vector2 allyRangeMultiplier = Vector2.one;
|
||||
|
||||
|
||||
[Header("resources")]
|
||||
public float harvestDuration = 1;
|
||||
public int harvestAmount = 1;
|
||||
public bool useRandomHarvestDuration = false;
|
||||
public int randomHarvestDurationMinimum = 0;
|
||||
public int randomHarvestDurationMaximum = 0;
|
||||
}
|
||||
11
Assets/Scripts/General/GlobalConfigFile.cs.meta
Normal file
11
Assets/Scripts/General/GlobalConfigFile.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32e788fd2a7bdaf4ab145b64231cb833
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -4,6 +4,11 @@ using UnityEngine;
|
||||
|
||||
public class Opponent : Entity
|
||||
{
|
||||
public override Vector2 RangeMultiplier => GlobalConfig.Instance.Current.enemyRangeMultiplier;
|
||||
public override float DamageMultiplier => GlobalConfig.Instance.Current.enemyDamageMultiplier;
|
||||
public override float AttackSpeedMultiplier => GlobalConfig.Instance.Current.enemyAttackSpeedMultiplier;
|
||||
public override float HpMultiplier => GlobalConfig.Instance.Current.enemyLifeMultiplier;
|
||||
public override float SpeedMultiplier => GlobalConfig.Instance.Current.enemySpeedMultiplier;
|
||||
|
||||
private Vector2 _movementVector = Vector2.zero;
|
||||
private Rigidbody2D _rigidbody;
|
||||
@ -16,11 +21,15 @@ public class Opponent : Entity
|
||||
Animation = gameObject.AddComponent<AnimationEntity>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
public override void Update()
|
||||
{
|
||||
if(IsEnemyDetected) {
|
||||
base.Update();
|
||||
if(IsEnemyDetected)
|
||||
{
|
||||
AttackEnemy();
|
||||
}else {
|
||||
}
|
||||
else
|
||||
{
|
||||
_movementVector.x = -Time.deltaTime * Speed;
|
||||
|
||||
transform.position += (Vector3)_movementVector;
|
||||
@ -36,7 +45,7 @@ public class Opponent : Entity
|
||||
void AttackEnemy()
|
||||
{
|
||||
//Attack Cooldown
|
||||
if(AttackSpeed < AttackSpeedWait)
|
||||
if(AttackInterval < AttackSpeedWait)
|
||||
{
|
||||
Animation.PlayAttackAnim();
|
||||
|
||||
|
||||
@ -5,8 +5,6 @@ using UnityEngine;
|
||||
/// </summary>
|
||||
public class ResourceMaker : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private int _resourceMakingAmount;
|
||||
[SerializeField]
|
||||
private Enum.ResourceChoice _resourceChoice;
|
||||
private ResourceManager _resourceManagerInstance;
|
||||
@ -43,6 +41,7 @@ public class ResourceMaker : MonoBehaviour
|
||||
|
||||
if (_isPlaying)
|
||||
{
|
||||
var amount = GlobalConfig.Instance.Current.harvestAmount;
|
||||
_timePassed += Time.deltaTime;
|
||||
float duration = _timePassed / _desiredTime;
|
||||
duration = duration * duration * (3.0f - 2.0f * duration);
|
||||
@ -53,13 +52,13 @@ public class ResourceMaker : MonoBehaviour
|
||||
switch (_resourceChoice)
|
||||
{
|
||||
case Enum.ResourceChoice.Rock:
|
||||
_resourceManagerInstance.RockAmount = _resourceMakingAmount;
|
||||
_resourceManagerInstance.RockAmount = amount;
|
||||
break;
|
||||
case Enum.ResourceChoice.Wood:
|
||||
_resourceManagerInstance.WoodAmount = _resourceMakingAmount;
|
||||
_resourceManagerInstance.WoodAmount = amount;
|
||||
break;
|
||||
case Enum.ResourceChoice.Food:
|
||||
_resourceManagerInstance.FoodAmount = _resourceMakingAmount;
|
||||
_resourceManagerInstance.FoodAmount = amount;
|
||||
break;
|
||||
}
|
||||
Destroy(gameObject);
|
||||
|
||||
@ -13,7 +13,7 @@ public class Root : MonoBehaviour
|
||||
private Transform _projectileSpawn;
|
||||
|
||||
void Attack() {
|
||||
_entity.Enemy.Hit( _entity.AttackDamage);
|
||||
_entity.Enemy.Hit(_entity.AttackDamage);
|
||||
if(_entity.Enemy.Hp <= 0) {
|
||||
_entity.Enemy.Death();
|
||||
_entity.IsEnemyDetected = false;
|
||||
|
||||
@ -12,47 +12,67 @@ public class ResourceTile : LevelTile
|
||||
public GameObject YieldPrefab => _yieldPrefab;
|
||||
private string YieldPrefabName => _yieldPrefab.name;
|
||||
|
||||
[SerializeField]
|
||||
private float _yieldSpeed = 1; //resource per second
|
||||
[SerializeField]
|
||||
[Range(0.0f, 5.0f)]
|
||||
private float _randomPositionConfig = 0.5f;
|
||||
private float _yieldCounter = 0;
|
||||
public bool Occupied { get; set; }
|
||||
|
||||
public override void LevelStart()
|
||||
{
|
||||
base.LevelStart();
|
||||
ResetYieldDuration();
|
||||
}
|
||||
public override void LevelUpdate()
|
||||
{
|
||||
//check if there is an harvester unit on top
|
||||
var hasFarmer = LevelManager.Instance.Get<Harvester>(x => x.Position.IsContainedIn(Position));
|
||||
if (!hasFarmer) return;
|
||||
|
||||
_yieldCounter -= Time.deltaTime;
|
||||
if (_yieldCounter > 0) return;
|
||||
|
||||
_yieldCounter += Time.deltaTime * _yieldSpeed;
|
||||
if (_yieldCounter < 1) return;
|
||||
if(_yieldPrefab != null)
|
||||
ResetYieldDuration();
|
||||
|
||||
if (_yieldPrefab != null)
|
||||
{
|
||||
_yieldCounter = 0;
|
||||
float rangeConfig = 0.5f + _randomPositionConfig;
|
||||
Vector3 yieldPosition = new Vector3(Position.x + Random.Range(-rangeConfig, rangeConfig), Position.y, Position.z);
|
||||
var yielded = Instantiate(_yieldPrefab, yieldPosition, Quaternion.identity);
|
||||
yielded.transform.SetParent(LevelManager.Instance.LevelTransform);
|
||||
YieldResource();
|
||||
}
|
||||
}
|
||||
private void YieldResource()
|
||||
{
|
||||
float rangeConfig = 0.5f + _randomPositionConfig;
|
||||
Vector3 yieldPosition = new Vector3(Position.x + Random.Range(-rangeConfig, rangeConfig), Position.y, Position.z);
|
||||
var yielded = Instantiate(_yieldPrefab, yieldPosition, Quaternion.identity);
|
||||
yielded.transform.SetParent(LevelManager.Instance.LevelTransform);
|
||||
}
|
||||
private void ResetYieldDuration()
|
||||
{
|
||||
_yieldCounter = 0;
|
||||
var config = GlobalConfig.Instance.Current;
|
||||
if (!config) return;
|
||||
|
||||
if (config.useRandomHarvestDuration)
|
||||
{
|
||||
float min = config.randomHarvestDurationMinimum,
|
||||
max = config.randomHarvestDurationMaximum;
|
||||
_yieldCounter = Random.Range(min, max);
|
||||
}
|
||||
else
|
||||
{
|
||||
_yieldCounter = config.harvestDuration;
|
||||
}
|
||||
}
|
||||
public override bool Equals(ILevelObject other)
|
||||
{
|
||||
return other is ResourceTile otherRes
|
||||
&& base.Equals(otherRes)
|
||||
&& _yieldPrefab == otherRes._yieldPrefab
|
||||
&& _yieldSpeed == otherRes._yieldSpeed
|
||||
&& Occupied == otherRes.Occupied;
|
||||
&& _yieldPrefab == otherRes._yieldPrefab;
|
||||
}
|
||||
public override Dictionary<string, object> ToDictionary()
|
||||
{
|
||||
var dict = base.ToDictionary();
|
||||
|
||||
dict[nameof(YieldPrefabName)] = YieldPrefabName;
|
||||
dict[nameof(_yieldSpeed)] = _yieldSpeed;
|
||||
dict[nameof(Occupied)] = Occupied;
|
||||
return dict;
|
||||
}
|
||||
public override void LoadDictionary(Dictionary<string, object> dict)
|
||||
@ -60,8 +80,5 @@ public class ResourceTile : LevelTile
|
||||
base.LoadDictionary(dict);
|
||||
var prefabName = dict[nameof(YieldPrefabName)].ToString();
|
||||
_yieldPrefab = Database.Instance.Prefabs[prefabName];
|
||||
_yieldSpeed = dict[nameof(_yieldSpeed)].ToFloat();
|
||||
_yieldCounter = dict[nameof(_yieldCounter)].ToFloat();
|
||||
Occupied = dict[nameof(Occupied)].ToBool();
|
||||
}
|
||||
}
|
||||
@ -15,5 +15,5 @@ MonoBehaviour:
|
||||
_sprite: {fileID: 21300000, guid: ccca3e050cb082b45af0a099790463f6, type: 3}
|
||||
_isCollidable: 0
|
||||
_yieldPrefab: {fileID: 6962989255644195630, guid: a2dc5d9672c10074fa9c35c12f6339c1, type: 3}
|
||||
_yieldSpeed: 0.1
|
||||
_yieldDuration: 5
|
||||
_randomPositionConfig: 0.25
|
||||
|
||||
@ -15,5 +15,5 @@ MonoBehaviour:
|
||||
_sprite: {fileID: 21300000, guid: 43582b3c6b60fd144bc56d8ab3b14349, type: 3}
|
||||
_isCollidable: 0
|
||||
_yieldPrefab: {fileID: 6962989255644195630, guid: f20569b5452c2b341a95d656b7534b7e, type: 3}
|
||||
_yieldSpeed: 0.1
|
||||
_yieldDuration: 5
|
||||
_randomPositionConfig: 0.5
|
||||
|
||||
@ -15,5 +15,5 @@ MonoBehaviour:
|
||||
_sprite: {fileID: 21300000, guid: b1e6b8ebeb2e25f4f8c5de93a31dd6a2, type: 3}
|
||||
_isCollidable: 0
|
||||
_yieldPrefab: {fileID: 6962989255644195630, guid: a2dc5d9672c10074fa9c35c12f6339c1, type: 3}
|
||||
_yieldSpeed: 0.1
|
||||
_yieldDuration: 5
|
||||
_randomPositionConfig: 0.5
|
||||
|
||||
@ -15,5 +15,5 @@ MonoBehaviour:
|
||||
_sprite: {fileID: 21300000, guid: 6298844400e212d40bce870425ac2a5b, type: 3}
|
||||
_isCollidable: 0
|
||||
_yieldPrefab: {fileID: 6962989255644195630, guid: 484f0eca1c74ae34694692de56a36739, type: 3}
|
||||
_yieldSpeed: 0.1
|
||||
_yieldDuration: 5
|
||||
_randomPositionConfig: 0.5
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user