Browse Source

Morale: Fliehende Armeen

bolt_update
Laurids Jeppe 3 years ago
parent
commit
c444552811
15 changed files with 480 additions and 103 deletions
  1. +2
    -2
      Assets/GWConquest/Animations/FleetIcon.controller
  2. +193
    -4
      Assets/GWConquest/Animations/FormationIconIdle.anim
  3. +91
    -64
      Assets/GWConquest/Animations/UnitDemoralized.anim
  4. +2
    -2
      Assets/GWConquest/Prefabs/UI/BattleUnitIcon.prefab
  5. +20
    -20
      Assets/GWConquest/Scenes/GalaxyMap.unity
  6. +24
    -3
      Assets/GWConquest/Scripts/Battle.cs
  7. +5
    -0
      Assets/GWConquest/Scripts/BattleFlank.cs
  8. +81
    -3
      Assets/GWConquest/Scripts/Formation.cs
  9. +15
    -0
      Assets/GWConquest/Scripts/GWBoltBehaviour.cs
  10. +5
    -0
      Assets/GWConquest/Scripts/Pathfinding.cs
  11. +20
    -2
      Assets/GWConquest/Scripts/UI/BattleUI.cs
  12. +13
    -3
      Assets/GWConquest/Scripts/Unit.cs
  13. BIN
      Assets/Photon/PhotonBolt/assemblies/bolt.user.dll
  14. BIN
      Assets/Photon/PhotonBolt/assemblies/bolt.user.dll.mdb
  15. +9
    -0
      Assets/Photon/PhotonBolt/project.json

+ 2
- 2
Assets/GWConquest/Animations/FleetIcon.controller View File

@ -21,7 +21,7 @@ AnimatorState:
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 0}
m_Motion: {fileID: 7400000, guid: 6c30eba957edfd140b5722883c43d407, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
@ -66,7 +66,7 @@ AnimatorController:
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer


+ 193
- 4
Assets/GWConquest/Animations/FormationIconIdle.anim View File

@ -16,7 +16,91 @@ AnimationClip:
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_FloatCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.5
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: MovementArrow
classID: 1
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.5
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Coloured/CooldownCircle
classID: 1
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.5
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Alpha
path: Coloured/Kreis/Icons
classID: 225
script: {fileID: 0}
m_PPtrCurves: []
m_SampleRate: 60
m_WrapMode: 0
@ -24,14 +108,35 @@ AnimationClip:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings: []
genericBindings:
- serializedVersion: 2
path: 797152718
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
- serializedVersion: 2
path: 4105417334
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
- serializedVersion: 2
path: 2898329170
attribute: 1574349066
script: {fileID: 0}
typeID: 225
customType: 0
isPPtrCurve: 0
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 1
m_StopTime: 0.5
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
@ -46,7 +151,91 @@ AnimationClip:
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EditorCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.5
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: MovementArrow
classID: 1
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.5
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Coloured/CooldownCircle
classID: 1
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.5
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Alpha
path: Coloured/Kreis/Icons
classID: 225
script: {fileID: 0}
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0


+ 91
- 64
Assets/GWConquest/Animations/UnitDemoralized.anim View File

@ -148,26 +148,16 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.083333336
value: 0
value: 0.6415094
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Alpha
path: HitpointBar
classID: 225
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
time: 2.4
value: 0.6415094
inSlope: 0
outSlope: 0
tangentMode: 136
@ -175,8 +165,8 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.083333336
value: 0.6415094
time: 2.5333333
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
@ -211,6 +201,24 @@ AnimationClip:
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 2.4
value: 0.6415094
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 2.5333333
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
@ -239,6 +247,24 @@ AnimationClip:
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 2.4
value: 0.6415094
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 2.5333333
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
@ -259,7 +285,7 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1.1
time: 2.5333333
value: 1
inSlope: 0
outSlope: 0
@ -267,15 +293,6 @@ AnimationClip:
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 2.4
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
@ -476,13 +493,6 @@ AnimationClip:
typeID: 114
customType: 0
isPPtrCurve: 0
- serializedVersion: 2
path: 172550804
attribute: 1574349066
script: {fileID: 0}
typeID: 225
customType: 0
isPPtrCurve: 0
- serializedVersion: 2
path: 4179961175
attribute: 2526845255
@ -504,13 +514,6 @@ AnimationClip:
typeID: 114
customType: 0
isPPtrCurve: 0
- serializedVersion: 2
path: 4179961175
attribute: 304273561
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
typeID: 114
customType: 0
isPPtrCurve: 0
- serializedVersion: 2
path: 2763502510
attribute: 2526845255
@ -546,6 +549,13 @@ AnimationClip:
typeID: 114
customType: 0
isPPtrCurve: 1
- serializedVersion: 2
path: 4179961175
attribute: 304273561
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
typeID: 114
customType: 0
isPPtrCurve: 0
pptrCurveMapping:
- {fileID: 21300000, guid: 7ac09bcb1adcd01479663dda61965d38, type: 3}
m_AnimationClipSettings:
@ -795,26 +805,16 @@ AnimationClip:
outWeight: 0.33333334
- serializedVersion: 3
time: 0.083333336
value: 0
value: 0.6415094
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_Alpha
path: HitpointBar
classID: 225
script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
time: 2.4
value: 0.6415094
inSlope: 0
outSlope: 0
tangentMode: 136
@ -822,8 +822,8 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.083333336
value: 0.6415094
time: 2.5333333
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
@ -858,6 +858,24 @@ AnimationClip:
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 2.4
value: 0.6415094
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 2.5333333
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
@ -886,6 +904,24 @@ AnimationClip:
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 2.4
value: 0.6415094
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 2.5333333
value: 1
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
@ -906,7 +942,7 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1.1
time: 2.5333333
value: 1
inSlope: 0
outSlope: 0
@ -914,15 +950,6 @@ AnimationClip:
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 2.4
value: 0
inSlope: 0
outSlope: 0
tangentMode: 136
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4


+ 2
- 2
Assets/GWConquest/Prefabs/UI/BattleUnitIcon.prefab View File

@ -563,7 +563,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1687732571317619585}
m_Enabled: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
@ -575,7 +575,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Sprite: {fileID: 21300000, guid: 22ba537ef206fd249b178df4f4b20786, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1


+ 20
- 20
Assets/GWConquest/Scenes/GalaxyMap.unity View File

@ -9139,7 +9139,7 @@ PrefabInstance:
- target: {fileID: 6934264675066306908, guid: b4b4aee434157c54cb53399d1578f446,
type: 3}
propertyPath: m_SizeDelta.x
value: -26.999998
value: -26.666664
objectReference: {fileID: 0}
- target: {fileID: 6934264676097734670, guid: b4b4aee434157c54cb53399d1578f446,
type: 3}
@ -10690,7 +10690,7 @@ PrefabInstance:
- target: {fileID: 6934264675066306908, guid: b4b4aee434157c54cb53399d1578f446,
type: 3}
propertyPath: m_SizeDelta.x
value: -26.999998
value: -26.666664
objectReference: {fileID: 0}
- target: {fileID: 6934264676097734670, guid: b4b4aee434157c54cb53399d1578f446,
type: 3}
@ -11836,7 +11836,7 @@ PrefabInstance:
- target: {fileID: 6934264675066306908, guid: b4b4aee434157c54cb53399d1578f446,
type: 3}
propertyPath: m_SizeDelta.x
value: -26.999998
value: -26.666664
objectReference: {fileID: 0}
- target: {fileID: 6934264676097734670, guid: b4b4aee434157c54cb53399d1578f446,
type: 3}
@ -15567,7 +15567,7 @@ PrefabInstance:
- target: {fileID: 6934264675066306908, guid: b4b4aee434157c54cb53399d1578f446,
type: 3}
propertyPath: m_SizeDelta.x
value: -26.999998
value: -26.666664
objectReference: {fileID: 0}
- target: {fileID: 6934264676097734670, guid: b4b4aee434157c54cb53399d1578f446,
type: 3}
@ -20444,7 +20444,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 6.3808594, y: -84.46875}
m_AnchoredPosition: {x: 6.3808594, y: -84.47}
m_SizeDelta: {x: -32.765747, y: 55}
m_Pivot: {x: 0.5, y: 1}
--- !u!1001 &351384642
@ -26192,7 +26192,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 6.3808594, y: -395.55078}
m_AnchoredPosition: {x: 6.3808594, y: -395.55}
m_SizeDelta: {x: -32.765747, y: 55}
m_Pivot: {x: 0.5, y: 1}
--- !u!1 &424836194
@ -35342,7 +35342,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 6.3808594, y: -162.23828}
m_AnchoredPosition: {x: 6.3808594, y: -162.24}
m_SizeDelta: {x: -32.765747, y: 55}
m_Pivot: {x: 0.5, y: 1}
--- !u!1 &571739760
@ -38219,8 +38219,8 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1227744837}
m_HandleRect: {fileID: 1227744836}
m_Direction: 2
m_Value: 0.99996597
m_Size: 0.9913695
m_Value: 0
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
@ -66594,7 +66594,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 6.3808594, y: -473.3203}
m_AnchoredPosition: {x: 6.3808594, y: -473.31998}
m_SizeDelta: {x: -32.765747, y: 55}
m_Pivot: {x: 0.5, y: 1}
--- !u!1 &1090130973
@ -69226,7 +69226,7 @@ PrefabInstance:
- target: {fileID: 6934264675066306908, guid: b4b4aee434157c54cb53399d1578f446,
type: 3}
propertyPath: m_SizeDelta.x
value: -26.999998
value: -26.666664
objectReference: {fileID: 0}
- target: {fileID: 6934264676097734670, guid: b4b4aee434157c54cb53399d1578f446,
type: 3}
@ -74753,8 +74753,8 @@ RectTransform:
m_Father: {fileID: 764301058}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.008630221}
m_AnchorMax: {x: 1, y: 0.9999998}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0.99999976}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 4, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
@ -76102,7 +76102,7 @@ PrefabInstance:
- target: {fileID: 6934264675066306908, guid: b4b4aee434157c54cb53399d1578f446,
type: 3}
propertyPath: m_SizeDelta.x
value: -26.999998
value: -26.666664
objectReference: {fileID: 0}
- target: {fileID: 6934264676097734670, guid: b4b4aee434157c54cb53399d1578f446,
type: 3}
@ -84311,7 +84311,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 6.3808594, y: -240.01172}
m_AnchoredPosition: {x: 6.3808594, y: -240.01001}
m_SizeDelta: {x: -32.765747, y: 55}
m_Pivot: {x: 0.5, y: 1}
--- !u!114 &1321808960 stripped
@ -100988,7 +100988,7 @@ PrefabInstance:
- target: {fileID: 6934264675066306908, guid: b4b4aee434157c54cb53399d1578f446,
type: 3}
propertyPath: m_SizeDelta.x
value: -26.999998
value: -26.666664
objectReference: {fileID: 0}
- target: {fileID: 6934264676097734670, guid: b4b4aee434157c54cb53399d1578f446,
type: 3}
@ -112261,7 +112261,7 @@ PrefabInstance:
- target: {fileID: 7870129596896663125, guid: 8b0edf9c7ac699a4da4b06f9b352ff47,
type: 3}
propertyPath: m_SizeDelta.y
value: -725.7947
value: -786.705
objectReference: {fileID: 0}
- target: {fileID: 7870129596896663125, guid: 8b0edf9c7ac699a4da4b06f9b352ff47,
type: 3}
@ -112306,7 +112306,7 @@ PrefabInstance:
- target: {fileID: 7870129596896663125, guid: 8b0edf9c7ac699a4da4b06f9b352ff47,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -338.5
value: -368.96
objectReference: {fileID: 0}
- target: {fileID: 7870129596896663125, guid: 8b0edf9c7ac699a4da4b06f9b352ff47,
type: 3}
@ -115506,7 +115506,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 6.3808594, y: -6.6992188}
m_AnchoredPosition: {x: 6.3808594, y: -6.700012}
m_SizeDelta: {x: -32.765747, y: 55}
m_Pivot: {x: 0.5, y: 1}
--- !u!1 &1857451470
@ -122753,7 +122753,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 6.3808594, y: -317.78125}
m_AnchoredPosition: {x: 6.3808594, y: -317.78}
m_SizeDelta: {x: -32.765747, y: 55}
m_Pivot: {x: 0.5, y: 1}
--- !u!1 &1981011821


+ 24
- 3
Assets/GWConquest/Scripts/Battle.cs View File

@ -52,6 +52,11 @@ namespace GWConquest
return State.Flanks[index].GetComponent<BattleFlank>();
}
public IEnumerable<BattleFlank> AllFlanks
{
get => State.Flanks.Select(e => e.GetComponent<BattleFlank>());
}
public Zone Zone {
get => Zone.GetFromId(State.Zone);
set {
@ -125,6 +130,15 @@ namespace GWConquest
{
FormationList.Remove(f.entity);
foreach(Unit u in f.Units)
{
if(u.CurrentFlank != null)
{
u.CurrentFlank.RemoveUnit(u);
u.CurrentFlank = null;
}
}
OnFormationsChanged();
}
@ -321,6 +335,13 @@ namespace GWConquest
return Mathf.Abs(enemyRow-ownRow) <= attackRange;
});
}
targets = targets.Where(u => !u.Class.IsHero && !u.IsDead);
if(targets.FirstOrDefault() == null)
{
targets = AllUnits.Where(u => !u.Class.IsHero && !u.IsDead && u.Player != action.Unit.Player && u.IsInReserve);
}
}
else if(action.ActionType == UnitActionType.Shelling) {
var unit = action.Unit;
@ -331,12 +352,12 @@ namespace GWConquest
else {
targets = unit.FlankTarget.Units;
}
targets = targets.Where(u => !u.Class.IsHero && !u.IsDead);
}
else {
throw new System.NotImplementedException();
}
targets = targets.Where(u => !u.IsDead);
}
if(targets.FirstOrDefault() == null)
{


+ 5
- 0
Assets/GWConquest/Scripts/BattleFlank.cs View File

@ -96,6 +96,11 @@ namespace GWConquest {
return coords.y * SlotsPerRow + coords.x;
}*/
public bool IsBroken {
get => State.Units.Count(e => e != null) == 0;
}
public void RemoveUnit(Unit unit)
{
int index = GetUnitIndex(unit);


+ 81
- 3
Assets/GWConquest/Scripts/Formation.cs View File

@ -6,7 +6,7 @@ using System.Collections;
namespace GWConquest
{
public class Formation : GWBoltBehaviour<IFormationState>, IMovable<Zone>
public class Formation : GWBoltEntityListener<IFormationState>, IMovable<Zone>
{
public static List<Formation> AllFormations = new List<Formation>();
@ -264,6 +264,29 @@ namespace GWConquest
MovementState = FormationMovementState.PreparingMovement;
}
public void BeginMovementServer(Zone targetZone, Formation targetFormation=null)
{
if(IsEmbarked)
{
if(ParentFormation != null && ParentFormation.entity.IsAttached)
{
MovementOriginFormation = ParentFormation;
ParentFormation.RemoveSubFormation(this);
}
}
PathQueue.Clear();
PathQueue.Add(targetZone);
if(targetFormation != null)
{
MovementTargetFormation = targetFormation;
}
SetActionCooldown(GameManager.Instance.MovementStartingCooldown);
MovementState = FormationMovementState.PreparingMovement;
}
public void MoveToZone(Zone target)
{
if(entity.IsOwner && MovementState == FormationMovementState.PreparingMovement)
@ -725,8 +748,45 @@ namespace GWConquest
public void TakeMoraleDamage(float moraleDamage)
{
BoltLog.Info("Formation {0} took {1} points of morale damage", this, moraleDamage);
Morale -= moraleDamage;
if(Morale > 0)
{
BoltLog.Info("Formation {0} took {1} points of morale damage", this, moraleDamage);
Morale -= moraleDamage;
if(Morale <= 0)
{
Morale = 0;
BoltLog.Info("Formation {0} is demoralized and will flee!", this);
var retreatZone = GetRetreatZone();
BeginMovementServer(retreatZone);
foreach(Unit u in Units)
{
if(u.CurrentFlank != null)
{
u.CurrentBattle.MoveUnitToReserve(u);
}
}
var evnt = FormationDemoralizedAnimEvent.Create(entity);
evnt.Send();
}
}
}
public Zone GetRetreatZone()
{
IEnumerable<Zone> zones;
if(currentZone.zoneType == ZoneType.Ground)
{
zones = currentZone.planet.pathfindingGraph.GetConnectedNodes(currentZone);
}
else {
zones = Planet.PlanetPathfindingGraph.GetConnectedNodes(currentZone);
}
var list = zones.ToList();
return list[UnityEngine.Random.Range(0, list.Count)];
}
public void OnAddedToBattle(Battle battle)
@ -734,8 +794,26 @@ namespace GWConquest
StartingMorale = Mathf.Min(Units.Sum(u => u.Class.Morale), MoraleCap);
Morale = StartingMorale;
BoltLog.Info("Morale calculated to {0} for formation {1}", Morale, this);
bool isArriving = MovementState == FormationMovementState.FinishingMovement;
foreach(Unit u in Units)
{
u.BattleState = isArriving ? BattleUnitState.Arriving : BattleUnitState.InReserve;
u.state.ActionCooldown = 0;
}
}
public override void OnEvent(FormationDemoralizedAnimEvent evnt)
{
if(HeroUnit != null && HeroUnit.CurrentIcon != null)
{
HeroUnit.CurrentIcon.PlayDemoralizedAnim();
}
}
}


+ 15
- 0
Assets/GWConquest/Scripts/GWBoltBehaviour.cs View File

@ -15,4 +15,19 @@ namespace GWConquest {
}
}
}
public abstract class GWBoltEntityListener<T> : EntityEventListener<T> where T : class, IState
{
private T _state = null;
public T State {
get {
if(_state == null)
{
_state = state;
}
return _state;
}
}
}
}

+ 5
- 0
Assets/GWConquest/Scripts/Pathfinding.cs View File

@ -166,6 +166,11 @@ namespace GWConquest
return dict;
}
public IEnumerable<T> GetConnectedNodes(T node)
{
return nodeMap[node].connections.Select(c => c.target.zone);
}
}
public interface IMovable<T>


+ 20
- 2
Assets/GWConquest/Scripts/UI/BattleUI.cs View File

@ -159,10 +159,28 @@ namespace GWConquest {
shotRT.SetParent(EffectsTransform);
shotRT.position = attacker.rectTransform.position;
var shotSize = shotRT.sizeDelta;
shotSize.x = Vector3.Distance(attacker.rectTransform.position, target.rectTransform.position);
Vector3 attackerPos = attacker.rectTransform.position;
Vector3 targetPos;
if(target.Unit.IsInReserve)
{
var panel = target.GetComponentInParent<BattleArmyPanel>();
Vector3[] corners = new Vector3[4];
panel.FormationsPanelTransform.GetWorldCorners(corners);
float offset = 100f;
float x = target.Unit.Player == Player.CurrentPlayer ? corners.Max(v => v.x) - offset : corners.Min(v => v.x) + offset;
//float x = panel.FormationsPanelTransform.position.x;
float y = attackerPos.y;
targetPos = new Vector3(x,y,0);
//Debug.LogFormat("Rect: {0}, target pos: {1}", rect, targetPos);
}
else {
targetPos = target.rectTransform.position;
}
shotSize.x = Vector3.Distance(attackerPos, targetPos);
shotRT.sizeDelta = shotSize;
shotRT.rotation = Quaternion.FromToRotation(Vector3.right, target.rectTransform.position - attacker.rectTransform.position);
shotRT.rotation = Quaternion.FromToRotation(Vector3.right, targetPos - attackerPos);
if(audioEffect != null)
{


+ 13
- 3
Assets/GWConquest/Scripts/Unit.cs View File

@ -205,7 +205,7 @@ namespace GWConquest
float surroundingMoraleDamage = Hitpoints <= 0 ? 3 : moraleDamage * SurroundingMoraleDamageFactor;
if(CurrentFlank != null)
if(!IsInReserve && CurrentFlank != null)
{
foreach(Unit u in CurrentFlank.Units)
{
@ -216,7 +216,9 @@ namespace GWConquest
}
}
Formation.TakeMoraleDamage(Hitpoints <= 0 ? Class.Morale : moraleDamage * FormationMoraleDamageFactor);
float flankFactor = IsInReserve ? 1.5f : 1f;
Formation.TakeMoraleDamage((Hitpoints <= 0 ? Class.Morale : moraleDamage * FormationMoraleDamageFactor) * flankFactor);
var evnt = UnitDamageAnimEvent.Create(entity);
evnt.Attacker = attacker.entity;
@ -269,7 +271,14 @@ namespace GWConquest
public override void SimulateOwner()
{
if(BattleState == BattleUnitState.Arriving)
{
if(Formation.MovementState != FormationMovementState.Idle)
{
BattleState = BattleUnitState.InReserve;
}
}
if (ActionCooldown <= 0)
{
state.ActionCooldown = 0;
@ -300,6 +309,7 @@ namespace GWConquest
}
//TODO shelling auch auf Flanke!
public bool IsInReserve {
get {
return BattleState == BattleUnitState.InReserve ||


BIN
Assets/Photon/PhotonBolt/assemblies/bolt.user.dll View File


BIN
Assets/Photon/PhotonBolt/assemblies/bolt.user.dll.mdb View File


+ 9
- 0
Assets/Photon/PhotonBolt/project.json View File

@ -2221,6 +2221,15 @@
"Name": "StopShellingEvent",
"Guid": "cf584f1e-f3a6-4ce9-86ce-876612d52d97",
"Groups": []
},
{
"$type": "Bolt.Compiler.EventDefinition, bolt.compiler",
"Properties": [],
"EntitySenders": 1,
"GlobalSenders": 3,
"Name": "FormationDemoralizedAnimEvent",
"Guid": "4f198445-9cbe-4d63-ad64-be9598b44eb1",
"Groups": []
}
],
"ActiveGroup": "Everything"

Loading…
Cancel
Save