invetory fix
This commit is contained in:
parent
cb8fbbafce
commit
fbbf806bab
@ -15,7 +15,7 @@ namespace Items
|
|||||||
|
|
||||||
public void Invoke(Action<Unit> action)
|
public void Invoke(Action<Unit> action)
|
||||||
{
|
{
|
||||||
OnItemUsed += action;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,9 +63,18 @@ namespace Items
|
|||||||
unit.UseItem(this);
|
unit.UseItem(this);
|
||||||
HexManager.UnitCurrentCell[unit.Color].cell.PaintHex(unit.Color);
|
HexManager.UnitCurrentCell[unit.Color].cell.PaintHex(unit.Color);
|
||||||
var cell = HexManager.UnitCurrentCell[unit.Color].cell.GetNeighbor(_direction);
|
var cell = HexManager.UnitCurrentCell[unit.Color].cell.GetNeighbor(_direction);
|
||||||
|
OnItemUsed?.Invoke(unit);
|
||||||
|
|
||||||
|
unit.UnitView.AnimActionDic[animName] -= DoPaint;
|
||||||
|
OnItemUsed = null;
|
||||||
|
if (cell == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
cell.PaintHex(unit.Color);
|
cell.PaintHex(unit.Color);
|
||||||
bool keepGoing = true;
|
bool keepGoing = true;
|
||||||
var moveDir = _direction;
|
|
||||||
|
|
||||||
itterationMove.ForEach(dir =>
|
itterationMove.ForEach(dir =>
|
||||||
{
|
{
|
||||||
if (!keepGoing) return;
|
if (!keepGoing) return;
|
||||||
@ -89,11 +98,7 @@ namespace Items
|
|||||||
cell.PaintHex(unit.Color);
|
cell.PaintHex(unit.Color);
|
||||||
});
|
});
|
||||||
|
|
||||||
OnItemUsed?.Invoke(unit);
|
|
||||||
|
|
||||||
|
|
||||||
unit.UnitView.AnimActionDic[animName] -= DoPaint;
|
|
||||||
OnItemUsed = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UseAbility(Unit unit)
|
public void UseAbility(Unit unit)
|
||||||
|
@ -30,7 +30,7 @@ namespace Items.ItemViews
|
|||||||
Despawn();
|
Despawn();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
transform.DOMove(unit.UnitView.transform.position, 0.1f).OnComplete(() =>
|
transform.DOMove(unit.UnitView.transform.position + new Vector3(0,1,0), 0.1f).OnComplete(() =>
|
||||||
{
|
{
|
||||||
unit.PickUpItem(_item);
|
unit.PickUpItem(_item);
|
||||||
Despawn();
|
Despawn();
|
||||||
|
@ -58,18 +58,19 @@ namespace Items
|
|||||||
}
|
}
|
||||||
|
|
||||||
Debug.DrawRay(ray.origin,
|
Debug.DrawRay(ray.origin,
|
||||||
ray.direction * hit.distance, UnityEngine.Color.red);
|
ray.direction * hit.distance, UnityEngine.Color.red, 10f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void UseAbility(Unit unit, Unit chosenUnit)
|
public void UseAbility(Unit unit, Unit chosenUnit)
|
||||||
{
|
{
|
||||||
if (unit == null)
|
if (chosenUnit == null || unit.isSwitched)
|
||||||
{
|
{
|
||||||
DeAim();
|
DeAim();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unit.UseItem(this);
|
unit.UseItem(this);
|
||||||
|
unit.isSwitched = true;
|
||||||
DeAim();
|
DeAim();
|
||||||
OnItemUsed?.Invoke(unit);
|
OnItemUsed?.Invoke(unit);
|
||||||
chosenUnit.IsBusy = true;
|
chosenUnit.IsBusy = true;
|
||||||
@ -81,6 +82,7 @@ namespace Items
|
|||||||
chosenUnit.SetCell(unitCell, true);
|
chosenUnit.SetCell(unitCell, true);
|
||||||
TimerHelper.Instance.StartTimer(() =>
|
TimerHelper.Instance.StartTimer(() =>
|
||||||
{
|
{
|
||||||
|
unit.isSwitched = false;
|
||||||
chosenUnit.SetCell(choseUnitCell, true, true);
|
chosenUnit.SetCell(choseUnitCell, true, true);
|
||||||
unit.SetCell(unitCell, true);
|
unit.SetCell(unitCell, true);
|
||||||
chosenUnit.IsStaned = false;
|
chosenUnit.IsStaned = false;
|
||||||
|
@ -39,6 +39,7 @@ namespace Units
|
|||||||
private UnitColor _easyCaptureColor;
|
private UnitColor _easyCaptureColor;
|
||||||
|
|
||||||
public bool IsStaned;
|
public bool IsStaned;
|
||||||
|
public bool isSwitched;
|
||||||
public int AttackBonus => _weapon.modifiedDamage - _weapon.damage;
|
public int AttackBonus => _weapon.modifiedDamage - _weapon.damage;
|
||||||
|
|
||||||
|
|
||||||
@ -424,7 +425,8 @@ namespace Units
|
|||||||
_instance.transform.position);
|
_instance.transform.position);
|
||||||
TimerHelper.Instance.StartTimer(() =>
|
TimerHelper.Instance.StartTimer(() =>
|
||||||
{
|
{
|
||||||
HexManager.PaintHexList(hexToPaint, UnitColor.Grey);
|
|
||||||
|
HexManager.PaintHexList(hexToPaint.Where(x => x.Color == Color).ToList(), UnitColor.Grey);
|
||||||
|
|
||||||
Object.Destroy(_instance);
|
Object.Destroy(_instance);
|
||||||
OnDeath?.Invoke(this);
|
OnDeath?.Invoke(this);
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user