added hard capture ui

This commit is contained in:
dddushesss 2021-12-27 22:54:14 +03:00
parent 4adea6e7cb
commit 94ffd6dd10
5 changed files with 73531 additions and 20 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 386f73f495e7e4e42aad2d61e2627e2b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -429,55 +429,55 @@ AnimatorController:
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: BackToIdle
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: Build
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: TreeAttack
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: Move
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: SuperJump
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: Frozen
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: isMoving
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
- m_Name: Death
m_Type: 9
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
@ -875,7 +875,7 @@ AnimatorState:
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: 7e952fd84f7afa045a61c323ff891957, type: 2}
m_Motion: {fileID: 7400000, guid: 386f73f495e7e4e42aad2d61e2627e2b, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:

View File

@ -667,6 +667,82 @@ Transform:
m_Father: {fileID: 2060305788687785820}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1943804347085943881
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5500493429322939587}
- component: {fileID: 4916495691362147002}
- component: {fileID: 3907028063982493874}
m_Layer: 5
m_Name: CaptureBar
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &5500493429322939587
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1943804347085943881}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6484114110451091213}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.01, y: 4.83}
m_SizeDelta: {x: 3, y: 0.3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4916495691362147002
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1943804347085943881}
m_CullTransparentMesh: 1
--- !u!114 &3907028063982493874
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1943804347085943881}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: -2685135706508046216, guid: bcfec907e0672ed45b69575096b4a1c2,
type: 3}
m_Type: 3
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 0
m_FillAmount: 0
m_FillClockwise: 1
m_FillOrigin: 1
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &1986084253358257366
GameObject:
m_ObjectHideFlags: 0
@ -3012,6 +3088,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
barCanvas: {fileID: 5591725933991455353}
aimCanvas: {fileID: 2334695180834975480}
captureBar: {fileID: 3907028063982493874}
--- !u!136 &8911891366586862002
CapsuleCollider:
m_ObjectHideFlags: 0

View File

@ -3,8 +3,10 @@ using System.Collections;
using System.Collections.Generic;
using DefaultNamespace.Weapons;
using DG.Tweening;
using DG.Tweening.Core;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Weapons;
public class UnitView : MonoBehaviour
@ -15,6 +17,7 @@ public class UnitView : MonoBehaviour
public Action<int> OnHit;
[SerializeField] private GameObject barCanvas;
[SerializeField] private GameObject aimCanvas;
[SerializeField] private Image captureBar;
private Stack<ShotUIView> _shootUIStack;
@ -26,7 +29,7 @@ public class UnitView : MonoBehaviour
private Coroutine _previosReload;
private int _mana;
private Action _capureHex;
private Coroutine _captureHexCoroutine;
private Sequence _sequence;
public GameObject BarCanvas => barCanvas;
public GameObject AimCanvas => aimCanvas;
@ -43,13 +46,21 @@ public class UnitView : MonoBehaviour
public void HardCaptureHex()
{
_captureHexCoroutine = StartCoroutine(HardCapture());
captureBar.gameObject.SetActive(true);
_sequence = DOTween.Sequence();
_sequence.Append(captureBar.DOFillAmount(1f, 3f).OnComplete(() =>
{
_capureHex.Invoke();
captureBar.DOFillAmount(0f, 0f).SetEase(Ease.Linear);
captureBar.gameObject.SetActive(false);
}));
}
public void StopHardCature()
{
if (_captureHexCoroutine != null)
StopCoroutine(_captureHexCoroutine);
_sequence.Kill();
captureBar.DOFillAmount(0f, 0f).SetEase(Ease.Linear);
captureBar.gameObject.SetActive(false);
}
public bool Shoot()
@ -130,10 +141,4 @@ public class UnitView : MonoBehaviour
_startRegen.Invoke();
StartCoroutine(Regen());
}
private IEnumerator HardCapture()
{
yield return new WaitForSeconds(3f);
_capureHex.Invoke();
}
}