fixed CaptureAbility.cs

This commit is contained in:
dddushesss 2022-02-14 05:01:53 +03:00
parent 76e280dfad
commit cb8fbbafce
2 changed files with 16 additions and 5 deletions

View File

@ -12,8 +12,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 461496314fe84e509ae72dd06538b62c, type: 3}
m_Name: CaptureTAbility
m_EditorClassIdentifier:
iconPrefab: {fileID: 3197816592181874056, guid: 2704c4f795b0d7748a3e3fa53be4d893, type: 3}
icon: {fileID: 21300000, guid: 543c4732bd2d47a41bdbbf2156eb358c, type: 3}
type: 0
aimCanvas: {fileID: 2273039178377770117, guid: 09a0317cbdff9fa479a18c9e20743a8e, type: 3}
itterationMove: 000000000000000000000000040000000500000001000000
itterationMove: 0000000000000000040000000500000001000000
animName: SuperJump

View File

@ -43,8 +43,13 @@ namespace Items
if(_aimInstance == null)
_aimInstance = Object.Instantiate(aimCanvas, unit.Instance.transform);
_aimInstance.SetActive(true);
_aimInstance.transform.LookAt(HexManager.UnitCurrentCell[unit.Color].cell
.GetNeighbor(direction).transform);
var cell = HexManager.UnitCurrentCell[unit.Color].cell
.GetNeighbor(direction);
if (cell == null)
{
return;
}
_aimInstance.transform.LookAt(cell.transform);
_direction = direction;
}
@ -56,6 +61,7 @@ namespace Items
private void DoPaint(Unit unit)
{
unit.UseItem(this);
HexManager.UnitCurrentCell[unit.Color].cell.PaintHex(unit.Color);
var cell = HexManager.UnitCurrentCell[unit.Color].cell.GetNeighbor(_direction);
cell.PaintHex(unit.Color);
bool keepGoing = true;
@ -94,6 +100,11 @@ namespace Items
{
var cell = HexManager.UnitCurrentCell[unit.Color].cell.GetNeighbor(_direction);
if (cell == null)
{
DeAim();
return;
}
unit.RotateUnit(new Vector2((cell.transform.position - unit.Instance.transform.position).normalized.x,
(cell.transform.position - unit.Instance.transform.position).normalized.z));
unit.Animator.SetTrigger(animName);