mana regen fix. hardcapture fix. mana limit capture
This commit is contained in:
parent
ff5bdd180a
commit
564d85ae6f
@ -421,6 +421,7 @@ MonoBehaviour:
|
||||
type: 3}
|
||||
grid: {fileID: 3185331048183402439}
|
||||
captureBar: {fileID: 3113562572513926796}
|
||||
captureBack: {fileID: 3936950508401920806}
|
||||
--- !u!1 &6201783996967795459
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -73418,11 +73418,4 @@ AnimationClip:
|
||||
script: {fileID: 0}
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_Events:
|
||||
- time: 0.53333336
|
||||
functionName: Step
|
||||
data:
|
||||
objectReferenceParameter: {fileID: 0}
|
||||
floatParameter: 0
|
||||
intParameter: 0
|
||||
messageOptions: 0
|
||||
m_Events: []
|
||||
|
@ -1689,9 +1689,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 04619977b07331e43a21b8d1bc33b6e9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
barCanvas: {fileID: 268172662505640299}
|
||||
barCanvas: {fileID: 6268534043668608886}
|
||||
aimCanvas: {fileID: 1011384888140022260}
|
||||
captureBar: {fileID: 7165383102699947033}
|
||||
--- !u!136 &1900872271281143359
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3857,18 +3856,18 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 09a0317cbdff9fa479a18c9e20743a8e, type: 3}
|
||||
--- !u!1 &1011384888140022260 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 2273039178377770117, guid: 09a0317cbdff9fa479a18c9e20743a8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 1261672157705434481}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!224 &1904133429405396096 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 859777855380249073, guid: 09a0317cbdff9fa479a18c9e20743a8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 1261672157705434481}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &1011384888140022260 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 2273039178377770117, guid: 09a0317cbdff9fa479a18c9e20743a8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 1261672157705434481}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &5786347879975309577
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3993,27 +3992,21 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: dec5dd0d644d5c548a53563e65837162, type: 3}
|
||||
--- !u!1 &268172662505640299 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 6049883652435591266, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 5786347879975309577}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!224 &1719605314077195295 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 5156761560679623958, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 5786347879975309577}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &7165383102699947033 stripped
|
||||
--- !u!114 &6268534043668608886 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 3692302203462554896, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
m_CorrespondingSourceObject: {fileID: 482855193181693567, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 5786347879975309577}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: 6650f022a8987a34e8da86d910b6e277, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
|
@ -3010,7 +3010,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 04619977b07331e43a21b8d1bc33b6e9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
barCanvas: {fileID: 5591725933991455353}
|
||||
barCanvas: {fileID: 1792219354502761572}
|
||||
aimCanvas: {fileID: 2334695180834975480}
|
||||
--- !u!136 &8911891366586862002
|
||||
CapsuleCollider:
|
||||
@ -3942,18 +3942,24 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: dec5dd0d644d5c548a53563e65837162, type: 3}
|
||||
--- !u!1 &5591725933991455353 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 6049883652435591266, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2192210941540280859}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!224 &6484114110451091213 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 5156761560679623958, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2192210941540280859}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &1792219354502761572 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 482855193181693567, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2192210941540280859}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6650f022a8987a34e8da86d910b6e277, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1001 &4606608419032177277
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -388,9 +388,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 04619977b07331e43a21b8d1bc33b6e9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
barCanvas: {fileID: 9197595637317142914}
|
||||
barCanvas: {fileID: 3090207795109785503}
|
||||
aimCanvas: {fileID: 8420239414472468003}
|
||||
captureBar: {fileID: 2264286872868117744}
|
||||
--- !u!136 &1571523103774403885
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3858,24 +3857,18 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: dec5dd0d644d5c548a53563e65837162, type: 3}
|
||||
--- !u!114 &2264286872868117744 stripped
|
||||
--- !u!114 &3090207795109785503 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 3692302203462554896, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
m_CorrespondingSourceObject: {fileID: 482855193181693567, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 3193594884886186464}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: 6650f022a8987a34e8da86d910b6e277, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &9197595637317142914 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 6049883652435591266, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 3193594884886186464}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!224 &7764648799730394358 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 5156761560679623958, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
@ -4081,15 +4074,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 09a0317cbdff9fa479a18c9e20743a8e, type: 3}
|
||||
--- !u!224 &6971375767392389975 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 859777855380249073, guid: 09a0317cbdff9fa479a18c9e20743a8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 7733179963500614310}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &8420239414472468003 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 2273039178377770117, guid: 09a0317cbdff9fa479a18c9e20743a8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 7733179963500614310}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!224 &6971375767392389975 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 859777855380249073, guid: 09a0317cbdff9fa479a18c9e20743a8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 7733179963500614310}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -3515,9 +3515,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 04619977b07331e43a21b8d1bc33b6e9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
barCanvas: {fileID: 8614863231585036848}
|
||||
barCanvas: {fileID: 2506490045236694061}
|
||||
aimCanvas: {fileID: 8409302512724572423}
|
||||
captureBar: {fileID: 1677050028044713794}
|
||||
--- !u!136 &2198464067484123790
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3933,16 +3932,16 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: dec5dd0d644d5c548a53563e65837162, type: 3}
|
||||
--- !u!114 &1677050028044713794 stripped
|
||||
--- !u!114 &2506490045236694061 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 3692302203462554896, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
m_CorrespondingSourceObject: {fileID: 482855193181693567, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2628876604355308114}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: 6650f022a8987a34e8da86d910b6e277, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!224 &7200088151662806852 stripped
|
||||
@ -3951,12 +3950,6 @@ RectTransform:
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2628876604355308114}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &8614863231585036848 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 6049883652435591266, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2628876604355308114}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &7726115386004852098
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -4081,15 +4074,15 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 09a0317cbdff9fa479a18c9e20743a8e, type: 3}
|
||||
--- !u!1 &8409302512724572423 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 2273039178377770117, guid: 09a0317cbdff9fa479a18c9e20743a8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 7726115386004852098}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!224 &6977806888759989363 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 859777855380249073, guid: 09a0317cbdff9fa479a18c9e20743a8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 7726115386004852098}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &8409302512724572423 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 2273039178377770117, guid: 09a0317cbdff9fa479a18c9e20743a8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 7726115386004852098}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -173,9 +173,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 04619977b07331e43a21b8d1bc33b6e9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
barCanvas: {fileID: 7624052504724712865}
|
||||
barCanvas: {fileID: 4361982831792671676}
|
||||
aimCanvas: {fileID: 3979930549707458788}
|
||||
captureBar: {fileID: 650245892348180691}
|
||||
--- !u!136 &6373024555497604353
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -3933,18 +3932,18 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 09a0317cbdff9fa479a18c9e20743a8e, type: 3}
|
||||
--- !u!1 &3979930549707458788 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 2273039178377770117, guid: 09a0317cbdff9fa479a18c9e20743a8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2932116763859057761}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!224 &2548601768047453584 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 859777855380249073, guid: 09a0317cbdff9fa479a18c9e20743a8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2932116763859057761}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &3979930549707458788 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 2273039178377770117, guid: 09a0317cbdff9fa479a18c9e20743a8e,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2932116763859057761}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &4196108535858654659
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -4069,27 +4068,21 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: dec5dd0d644d5c548a53563e65837162, type: 3}
|
||||
--- !u!1 &7624052504724712865 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 6049883652435591266, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 4196108535858654659}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!224 &9055592242171101397 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 5156761560679623958, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 4196108535858654659}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &650245892348180691 stripped
|
||||
--- !u!114 &4361982831792671676 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 3692302203462554896, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
m_CorrespondingSourceObject: {fileID: 482855193181693567, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 4196108535858654659}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: 6650f022a8987a34e8da86d910b6e277, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
|
@ -20,7 +20,7 @@ MonoBehaviour:
|
||||
unitPrefa: {fileID: 7527582019267571087, guid: f102085e8bc4cad4992d43b84dee1055,
|
||||
type: 3}
|
||||
color: 3
|
||||
manaRegen: 1
|
||||
manaRegen: 5
|
||||
maxMana: 100
|
||||
maxHP: 100
|
||||
inventoryCapacity: 4
|
||||
@ -31,7 +31,7 @@ MonoBehaviour:
|
||||
unitPrefa: {fileID: 3762867976042010436, guid: d00f156879942114488e4db0689a3fb7,
|
||||
type: 3}
|
||||
color: 4
|
||||
manaRegen: 10
|
||||
manaRegen: 5
|
||||
maxMana: 100
|
||||
maxHP: 100
|
||||
inventoryCapacity: 4
|
||||
@ -42,7 +42,7 @@ MonoBehaviour:
|
||||
unitPrefa: {fileID: 742650227762578155, guid: 97b4a76c55741764e880b63d6e1514a9,
|
||||
type: 3}
|
||||
color: 0
|
||||
manaRegen: 10
|
||||
manaRegen: 5
|
||||
maxMana: 100
|
||||
maxHP: 100
|
||||
inventoryCapacity: 4
|
||||
|
@ -86,6 +86,9 @@ namespace Units
|
||||
{
|
||||
if (!_cell.GetNeighbor(direction) || _isBusy || _cell.GetNeighbor(direction).Color != UnitColor.GREY &&
|
||||
HexManager.UnitCurrentCell[_cell.GetNeighbor(direction).Color].cell == _cell.GetNeighbor(direction)) return;
|
||||
|
||||
if( _mana - _hexGrid.HexCaptureCost <= 0 && _cell.GetNeighbor(direction).Color != Color) return;
|
||||
|
||||
_unitView.StopHardCapture();
|
||||
if (_cell.GetNeighbor(direction).Color == _data.color)
|
||||
{
|
||||
@ -161,10 +164,8 @@ namespace Units
|
||||
neigh?.PaintHex(_data.color);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
HexManager.UnitCurrentCell.Add(_data.color, (_cell, this));
|
||||
//
|
||||
|
||||
_instance = Object.Instantiate(_data.unitPrefa, _cell.transform.parent);
|
||||
_instance.transform.localPosition = _cell.transform.localPosition;
|
||||
@ -172,7 +173,7 @@ namespace Units
|
||||
_isAlive = true;
|
||||
_animator = _instance.GetComponent<Animator>();
|
||||
_unitView = _instance.GetComponent<UnitView>();
|
||||
_barCanvas = _unitView.BarCanvas.GetComponent<BarCanvas>();
|
||||
_barCanvas = _unitView.BarCanvas;
|
||||
_unitView.SetUp(_barCanvas.SpawnShotUI(_weapon.shots), _weapon, RegenMana, _data.manaRegen, CaptureHex,
|
||||
this);
|
||||
SetAnimLength();
|
||||
|
@ -11,6 +11,7 @@ public class BarCanvas : MonoBehaviour
|
||||
[SerializeField] private ShotUIView shotPrefab;
|
||||
[SerializeField] private GameObject grid;
|
||||
[SerializeField] private Image captureBar;
|
||||
[SerializeField] private GameObject captureBack;
|
||||
|
||||
public Image HealthBar => healthBar;
|
||||
public Image ManaBar => manaBar;
|
||||
@ -18,6 +19,8 @@ public class BarCanvas : MonoBehaviour
|
||||
|
||||
public Image CaptureBar => captureBar;
|
||||
|
||||
public GameObject CaptureBack => captureBack;
|
||||
|
||||
public Stack<ShotUIView> SpawnShotUI(int count)
|
||||
{
|
||||
Stack<ShotUIView> stack = new Stack<ShotUIView>();
|
||||
|
@ -19,7 +19,7 @@ public class UnitView : MonoBehaviour
|
||||
public Action OnAttackEnd;
|
||||
public Action OnAttack;
|
||||
public Action<int> OnHit;
|
||||
[SerializeField] private GameObject barCanvas;
|
||||
[SerializeField] private BarCanvas barCanvas;
|
||||
[SerializeField] private GameObject aimCanvas;
|
||||
|
||||
|
||||
@ -30,14 +30,14 @@ public class UnitView : MonoBehaviour
|
||||
private Action _startRegen;
|
||||
private Coroutine _previosRegen;
|
||||
private Coroutine _previosReload;
|
||||
|
||||
|
||||
private int _mana;
|
||||
private Action _capureHex;
|
||||
private Sequence _sequence;
|
||||
private AudioSource _audioSource;
|
||||
private Unit _unit;
|
||||
|
||||
public GameObject BarCanvas => barCanvas;
|
||||
public BarCanvas BarCanvas => barCanvas;
|
||||
public GameObject AimCanvas => aimCanvas;
|
||||
public UnitColor Color => _unit.Color;
|
||||
|
||||
@ -56,14 +56,14 @@ public class UnitView : MonoBehaviour
|
||||
public void HardCaptureHex(HexCell cell)
|
||||
{
|
||||
_unit.IsBusy = true;
|
||||
|
||||
_unit.BarCanvas.CaptureBar.gameObject.SetActive(true);
|
||||
|
||||
barCanvas.CaptureBack.SetActive(true);
|
||||
_sequence = DOTween.Sequence();
|
||||
_sequence.Append(_unit.BarCanvas.CaptureBar.DOFillAmount(1f, 1f).SetEase(Ease.Linear).OnComplete(() =>
|
||||
{
|
||||
_capureHex?.Invoke();
|
||||
_unit.BarCanvas.CaptureBar.DOFillAmount(0f, 1f).SetEase(Ease.Linear).OnComplete(()=>_unit.IsBusy = false);
|
||||
_unit.BarCanvas.CaptureBar.gameObject.SetActive(false);
|
||||
_unit.BarCanvas.CaptureBar.DOFillAmount(0f, 1f).SetEase(Ease.Linear).OnComplete(() => _unit.IsBusy = false);
|
||||
barCanvas.CaptureBack.SetActive(false);
|
||||
MusicController.Instance.PlayRandomClip(MusicController.Instance.MusicData.SfxMusic.Captures,
|
||||
cell.gameObject);
|
||||
}));
|
||||
@ -74,8 +74,8 @@ public class UnitView : MonoBehaviour
|
||||
public void StopHardCapture()
|
||||
{
|
||||
_sequence.Kill();
|
||||
_unit.BarCanvas.CaptureBar.DOFillAmount(0f, 0f).SetEase(Ease.Linear);
|
||||
_unit.BarCanvas.CaptureBar.gameObject.SetActive(false);
|
||||
barCanvas.CaptureBar.DOFillAmount(0f, 0f).SetEase(Ease.Linear);
|
||||
_unit.BarCanvas.CaptureBack.SetActive(false);
|
||||
_unit.IsBusy = false;
|
||||
}
|
||||
|
||||
@ -96,17 +96,13 @@ public class UnitView : MonoBehaviour
|
||||
|
||||
public void RegenMana(int mana)
|
||||
{
|
||||
|
||||
if (_previosRegen != null)
|
||||
{
|
||||
StopCoroutine(_previosRegen);
|
||||
}
|
||||
|
||||
_mana = mana;
|
||||
//_startRegen.Invoke();
|
||||
_previosRegen = StartCoroutine(Regen());
|
||||
|
||||
//return _mana;
|
||||
}
|
||||
|
||||
private void Step()
|
||||
@ -150,48 +146,42 @@ public class UnitView : MonoBehaviour
|
||||
|
||||
private IEnumerator Reload()
|
||||
{
|
||||
if (_toReloadStack.Count == 0) yield break; //TODO При частой стрльбе перезарядка работает некорректно
|
||||
if (_toReloadStack.Count == 0) yield break;
|
||||
yield return new WaitForSeconds(_weapon.reloadTime);
|
||||
if (_toReloadStack.Count == 0) yield break;
|
||||
var shot = _toReloadStack.Pop();
|
||||
|
||||
// _shootUIStack.Push(shot);
|
||||
shot.Switch();
|
||||
_shootUIStack.Push(shot);
|
||||
|
||||
|
||||
shot.Switch();
|
||||
_shootUIStack.Push(shot);
|
||||
|
||||
foreach (var item in _toReloadStack)
|
||||
{
|
||||
if(Time.deltaTime < _weapon.reloadTime)
|
||||
if (Time.deltaTime < _weapon.reloadTime)
|
||||
{
|
||||
StopCoroutine(_previosReload);
|
||||
_previosReload = null;
|
||||
}
|
||||
_previosReload = StartCoroutine(Reload());
|
||||
|
||||
|
||||
_previosReload = StartCoroutine(Reload());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private IEnumerator Regen()
|
||||
{
|
||||
if (_mana >= 100)
|
||||
if (_mana >= 100)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
|
||||
yield return new WaitForSeconds(2f);
|
||||
while(_mana < 100)
|
||||
yield return new WaitForSeconds(1f);
|
||||
if (_mana < 100)
|
||||
{
|
||||
_mana += _manaRegen;
|
||||
_startRegen.Invoke();
|
||||
_startRegen.Invoke();
|
||||
}
|
||||
|
||||
//StartCoroutine(Regen());
|
||||
_previosRegen = null;
|
||||
|
||||
|
||||
//
|
||||
_previosRegen = StartCoroutine(Regen());;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user