Fix issue with UI container update
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
using Assets.Scripts.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Player : BaseCharacter
|
||||
{
|
||||
public event EventHandler<bool> OnContainerChanged;
|
||||
public static Player Instance { get; private set; }
|
||||
|
||||
[SerializeField]
|
||||
@@ -118,16 +120,21 @@ public class Player : BaseCharacter
|
||||
containerItem.transform.parent = _holdPoint;
|
||||
containerItem.transform.localPosition = Vector3.zero;
|
||||
_containerItem = containerItem;
|
||||
OnContainerChanged.Invoke(this,true);
|
||||
}
|
||||
|
||||
public void ClearContainerItem()
|
||||
{
|
||||
OnContainerChanged.Invoke(this, false);
|
||||
Destroy(_containerItem.gameObject);
|
||||
_containerItem = null;
|
||||
}
|
||||
|
||||
public ContainerItem GetContainerItem()
|
||||
{
|
||||
return _containerItem;
|
||||
}
|
||||
public void ClearContainerItem()
|
||||
{
|
||||
Destroy(_containerItem.gameObject);
|
||||
_containerItem = null;
|
||||
}
|
||||
|
||||
public bool IsHoldContainerItem()
|
||||
{
|
||||
return _containerItem != null;
|
||||
|
||||
Reference in New Issue
Block a user