Pull request #85: Castle Unit Implementation
Merge in CGD/gather-and-defend from origin/feature/CastleUnitImplementation to main * commit 'e36d43d69ab6aa1092511fbb237421785f3c25c7': - Fixed an issue where the castle arrow couldn't fire at enemies in an angle, and only straight forward; - Modified the castle's infos so that it fires only 4 arrows per intervals instead of 5. Implemented the basis for the castle unit, including having it shoot, the shooting range, and the upgrading logic. Implemented Castle data to the game. The only thing it's missing is the attack pattern.
This commit is contained in:
commit
219aa36d62
17
Assets/Design/UnitUpgrades/Buildings/Upgrade_Castle.asset
Normal file
17
Assets/Design/UnitUpgrades/Buildings/Upgrade_Castle.asset
Normal file
@ -0,0 +1,17 @@
|
||||
%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: d1391306ffe53984bb2bc314f1d2919f, type: 3}
|
||||
m_Name: Upgrade_Castle
|
||||
m_EditorClassIdentifier:
|
||||
_upgradeUnitCard: {fileID: 11400000, guid: 4728bef0a18b70945bedf5b1190c491e, type: 2}
|
||||
_upgradePrefab: {fileID: 1436362432952518814, guid: 8d56b160dedb7f84d830d749372fe8e8, type: 3}
|
||||
_upgradeCardArt: {fileID: 21300000, guid: bc54d5d5ac69f334daf7b36882bd5199, type: 3}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20ad512fe083b804d85da6dafa69ecaf
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,5 +1,36 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &677021742661546270
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7055490709728624221}
|
||||
m_Layer: 0
|
||||
m_Name: '@projectileSpawn'
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 6519382022992737161, guid: 0000000000000000d000000000000000, type: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7055490709728624221
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 677021742661546270}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -0.103, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 8169559242600365314}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1436362432952518814
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -9,11 +40,12 @@ GameObject:
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8393796362083852573}
|
||||
- component: {fileID: 5337801381275763447}
|
||||
- component: {fileID: 6803870855974115111}
|
||||
- component: {fileID: -2623136057881025473}
|
||||
- component: {fileID: 3412246377317269183}
|
||||
- component: {fileID: -2943795733505287777}
|
||||
- component: {fileID: 498655111277194201}
|
||||
- component: {fileID: 7118484083738872079}
|
||||
m_Layer: 0
|
||||
m_Name: Castle
|
||||
m_TagString: Ally
|
||||
@ -36,26 +68,10 @@ Transform:
|
||||
- {fileID: 6894793432076062629}
|
||||
- {fileID: 4738724134341998529}
|
||||
- {fileID: 4727854499611739481}
|
||||
- {fileID: 8169559242600365314}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &5337801381275763447
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1436362432952518814}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 27e69fa6018bf654196267d829031f1a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_lifeBar: {fileID: 981581452810264329}
|
||||
_hp: 100
|
||||
_speed: 0
|
||||
_attack_damage: 1
|
||||
_attack_interval: 2
|
||||
--- !u!61 &6803870855974115111
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -212,6 +228,37 @@ AudioSource:
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!114 &498655111277194201
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1436362432952518814}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 295347fae18ea1442ae2cff64e3ea6d4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_lifeBar: {fileID: 981581452810264329}
|
||||
_hp: 20
|
||||
_speed: 1
|
||||
_attack_damage: 2
|
||||
_attack_interval: 2
|
||||
_enemy: {fileID: 0}
|
||||
_root: {fileID: 3828680565076245792}
|
||||
--- !u!114 &7118484083738872079
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1436362432952518814}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 52b5039c6ed892a42b71ae16566ae511, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1517238551605579599
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -257,7 +304,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 531d7966d86bd0c4d83baf58bcb56cd5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_entityLinked: {fileID: 5337801381275763447}
|
||||
_entityLinked: {fileID: 498655111277194201}
|
||||
--- !u!61 &3389094527817988571
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -274,16 +321,65 @@ BoxCollider2D:
|
||||
m_Offset: {x: 0, 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
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 1, y: 1}
|
||||
newSize: {x: 11.65, y: 5.55}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 5, y: 3}
|
||||
m_Size: {x: 10, y: 6}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!1 &7593581371702012092
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8169559242600365314}
|
||||
- component: {fileID: 3828680565076245792}
|
||||
m_Layer: 0
|
||||
m_Name: root
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &8169559242600365314
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7593581371702012092}
|
||||
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:
|
||||
- {fileID: 7055490709728624221}
|
||||
- {fileID: 7939484193916151742}
|
||||
m_Father: {fileID: 8393796362083852573}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &3828680565076245792
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7593581371702012092}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c0fbd934c179894458914437255781c4, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_entity: {fileID: 498655111277194201}
|
||||
_projectile: {fileID: 6962989255644195630, guid: 8c97d676f9e78de408a30be69193ca5e, type: 3}
|
||||
_projectileSpawn: {fileID: 7055490709728624221}
|
||||
--- !u!1 &7803635882566565305
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -368,6 +464,78 @@ SpriteRenderer:
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &8310043151180040893
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7939484193916151742}
|
||||
- component: {fileID: 5488513296025383449}
|
||||
- component: {fileID: 8186041413564706385}
|
||||
m_Layer: 0
|
||||
m_Name: detection
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7939484193916151742
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8310043151180040893}
|
||||
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: 8169559242600365314}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!61 &5488513296025383449
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8310043151180040893}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 1
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, 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: 10, y: 6}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!114 &8186041413564706385
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8310043151180040893}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 531d7966d86bd0c4d83baf58bcb56cd5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_entityLinked: {fileID: 498655111277194201}
|
||||
--- !u!1001 &6268201541322694619
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -137,6 +137,7 @@ MonoBehaviour:
|
||||
_upgradeUI: {fileID: 4817988606444742093, guid: 1d481c7093a8d2443a04261fd7c72be2, type: 3}
|
||||
_upgradeList:
|
||||
- {fileID: 11400000, guid: bb9859dfbbeec1d4583f967ab91c2248, type: 2}
|
||||
- {fileID: 11400000, guid: 20ad512fe083b804d85da6dafa69ecaf, type: 2}
|
||||
--- !u!61 &1993481641639217671
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -201,6 +202,7 @@ MonoBehaviour:
|
||||
_speed: 0
|
||||
_attack_damage: 0
|
||||
_attack_interval: 0
|
||||
_enemy: {fileID: 0}
|
||||
--- !u!114 &6252103591577139412
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
230
Assets/Prefabs/CastleProjectile.prefab
Normal file
230
Assets/Prefabs/CastleProjectile.prefab
Normal file
@ -0,0 +1,230 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &6962989255644195630
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6962989255644195631}
|
||||
- component: {fileID: -1491803373025033585}
|
||||
- component: {fileID: 8133954670424616578}
|
||||
m_Layer: 0
|
||||
m_Name: CastleProjectile
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &6962989255644195631
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6962989255644195630}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -6.61, y: -0.638, z: 1.8112363}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 6962989256011107500}
|
||||
- {fileID: 6802302589573039538}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!50 &-1491803373025033585
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6962989255644195630}
|
||||
m_BodyType: 0
|
||||
m_Simulated: 1
|
||||
m_UseFullKinematicContacts: 0
|
||||
m_UseAutoMass: 0
|
||||
m_Mass: 1
|
||||
m_LinearDrag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_GravityScale: 0
|
||||
m_Material: {fileID: 0}
|
||||
m_Interpolate: 0
|
||||
m_SleepingMode: 1
|
||||
m_CollisionDetection: 0
|
||||
m_Constraints: 4
|
||||
--- !u!114 &8133954670424616578
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6962989255644195630}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 01782bd631a6e1446956ed140a24c530, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_detectionLinked: {fileID: 4130391605812397686}
|
||||
straightProjectile: 1
|
||||
_angle: 10
|
||||
_speed: 1
|
||||
--- !u!1 &6962989256011107503
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6962989256011107500}
|
||||
- component: {fileID: 6962989256011107501}
|
||||
m_Layer: 0
|
||||
m_Name: exmeple
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &6962989256011107500
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6962989256011107503}
|
||||
m_LocalRotation: {x: 0, y: -0, z: 0.7071068, w: -0.7071068}
|
||||
m_LocalPosition: {x: 0.0259, y: 0.01, z: 0}
|
||||
m_LocalScale: {x: 0.5394133, y: 0.56488746, z: 0.9686}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6962989255644195631}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 270}
|
||||
--- !u!212 &6962989256011107501
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6962989256011107503}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 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: 364159097
|
||||
m_SortingLayer: 1
|
||||
m_SortingOrder: 4
|
||||
m_Sprite: {fileID: 21300000, guid: b28a7c5aeb45b224983f69339965c55d, 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.06, y: 1.69}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &8726647054546243319
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6802302589573039538}
|
||||
- component: {fileID: 7006189111012443782}
|
||||
- component: {fileID: 4130391605812397686}
|
||||
m_Layer: 0
|
||||
m_Name: detection
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &6802302589573039538
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8726647054546243319}
|
||||
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: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!61 &7006189111012443782
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8726647054546243319}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 1
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0.16277367, y: 0.016521543}
|
||||
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.3744527, y: 0.17825907}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!114 &4130391605812397686
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 8726647054546243319}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 531d7966d86bd0c4d83baf58bcb56cd5, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_entityLinked: {fileID: 0}
|
||||
7
Assets/Prefabs/CastleProjectile.prefab.meta
Normal file
7
Assets/Prefabs/CastleProjectile.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c97d676f9e78de408a30be69193ca5e
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -44,7 +44,7 @@ public class Ally : Entity
|
||||
public override void LevelStart()
|
||||
{
|
||||
base.LevelStart();
|
||||
if(this is not Building) ResourceManager.Instance.CurrentPopulation += PopulationCost;
|
||||
if (this is not Building) ResourceManager.Instance.CurrentPopulation += PopulationCost;
|
||||
}
|
||||
public override void LevelDestroy()
|
||||
{
|
||||
|
||||
62
Assets/Scripts/Ally/Castle.cs
Normal file
62
Assets/Scripts/Ally/Castle.cs
Normal file
@ -0,0 +1,62 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Castle : Building
|
||||
{
|
||||
public float PopulationGiven => GlobalConfig.Instance.Current.populationGivenPerHouse;
|
||||
|
||||
[SerializeField]
|
||||
private Root _root;
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
base.Start();
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
base.Update();
|
||||
if (IsEnemyDetected)
|
||||
{
|
||||
AttackEnemy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void LevelStart()
|
||||
{
|
||||
ResourceManager.Instance.MaximumPopulation += PopulationGiven * 2;
|
||||
base.LevelStart();
|
||||
}
|
||||
public override void LevelDestroy()
|
||||
{
|
||||
ResourceManager.Instance.MaximumPopulation -= PopulationGiven * 2;
|
||||
base.LevelDestroy();
|
||||
}
|
||||
|
||||
void AttackEnemy()
|
||||
{
|
||||
//Attack Cooldown
|
||||
if (AttackInterval < AttackSpeedWait)
|
||||
{
|
||||
|
||||
for(int i = 0; i < 4 && IsEnemyDetected; i++)
|
||||
{
|
||||
Invoke("ShootInterval", 0.1f * i);
|
||||
if(Enemy.Hp <= 0) IsEnemyDetected = false;
|
||||
}
|
||||
|
||||
AttackSpeedWait = 0f;
|
||||
|
||||
}
|
||||
|
||||
AttackSpeedWait += Time.deltaTime;
|
||||
|
||||
}
|
||||
|
||||
void ShootInterval()
|
||||
{
|
||||
_root.ShotProjectile();
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Ally/Castle.cs.meta
Normal file
11
Assets/Scripts/Ally/Castle.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 295347fae18ea1442ae2cff64e3ea6d4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -68,7 +68,7 @@ public class AnimationEntity : MonoBehaviour
|
||||
|
||||
public void PlayAttackAnim()
|
||||
{
|
||||
if(!_isDead) {
|
||||
if(!_isDead && _animatorEntity != null) {
|
||||
_animatorEntity.speed = AttackSpeedMultiplier;
|
||||
_animatorEntity.Play("attack", 0, 0f);
|
||||
entityState = EntityAnimationState.Attacking;
|
||||
|
||||
@ -11,6 +11,9 @@ public class Projectile : MonoBehaviour
|
||||
[SerializeField]
|
||||
private bool straightProjectile = false;
|
||||
|
||||
private float _time = 0f;
|
||||
private float _duration = 1f;
|
||||
|
||||
[SerializeField]
|
||||
private float _angle = 10f; //Default
|
||||
[SerializeField]
|
||||
@ -48,8 +51,14 @@ public class Projectile : MonoBehaviour
|
||||
{
|
||||
if (straightProjectile)
|
||||
{
|
||||
transform.position = new Vector2(_initialX + _speedTime, _initialY);
|
||||
_speedTime += _speed * Time.deltaTime;
|
||||
transform.position = Vector2.Lerp(new Vector2(_initialX, _initialY),
|
||||
new Vector2(_vectorEnd.x, _vectorEnd.y), _time/_duration);
|
||||
|
||||
//TODO: Implementer cette methode pour mieux faire fonctionner le projectile lorsque possible.
|
||||
//transform.LookAt(VectorEnd, Vector3.forward);
|
||||
|
||||
_time += Time.deltaTime;
|
||||
|
||||
if (transform.position.x >= _vectorEnd.x)
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user