UI fixes, add npc base class
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
namespace Assets.Scripts.Characters
|
||||
{
|
||||
public class Npc : BaseCharacter
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
base.IntCharacter();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57bc7fa5d71cfbf4685a51d4fd4be2ab
|
||||
@@ -5,9 +5,9 @@ using UnityEngine;
|
||||
|
||||
public class Player : BaseCharacter
|
||||
{
|
||||
public event EventHandler<bool> OnContainerChanged;
|
||||
public event EventHandler<bool> OnContainerChanged;
|
||||
public static Player Instance { get; private set; }
|
||||
|
||||
|
||||
private HoldPoint _holdPoint;
|
||||
|
||||
private PlayerStates _currentActing;
|
||||
@@ -15,12 +15,12 @@ public class Player : BaseCharacter
|
||||
public Dictionary<StatsId, object> Stats;
|
||||
public JobPositions JobPosition { get; set; }
|
||||
|
||||
private List<EducationInfoSO> _completedCourses=new();
|
||||
private List<EducationInfoSO> _completedCourses = new();
|
||||
public EducationInfoSO ActiveCourse { get; set; }
|
||||
public EducationSkill Education { get; set; }
|
||||
|
||||
private ContainerItem _containerItem;
|
||||
|
||||
|
||||
private string _locationName;
|
||||
|
||||
private void Awake()
|
||||
@@ -43,7 +43,7 @@ public class Player : BaseCharacter
|
||||
private void Start()
|
||||
{
|
||||
base.IntCharacter();
|
||||
_holdPoint= GetComponentInChildren<HoldPoint>();
|
||||
_holdPoint = GetComponentInChildren<HoldPoint>();
|
||||
GameManager.Instance.Time.OnMinuteChanged += UpdateStatsByClock;
|
||||
_animator.applyRootMotion = true;
|
||||
_navAgent.updatePosition = false;
|
||||
@@ -84,7 +84,7 @@ public class Player : BaseCharacter
|
||||
AddTask(new PlayerTasks(Tasks.Interact, interactionItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPlayerActing(PlayerStates state)
|
||||
{
|
||||
@@ -124,14 +124,16 @@ public class Player : BaseCharacter
|
||||
containerItem.transform.parent = _holdPoint.transform;
|
||||
containerItem.transform.localPosition = Vector3.zero;
|
||||
_containerItem = containerItem;
|
||||
OnContainerChanged.Invoke(this,true);
|
||||
OnContainerChanged.Invoke(this, true);
|
||||
}
|
||||
|
||||
|
||||
public void ClearContainerItem()
|
||||
{
|
||||
if (_containerItem == null)
|
||||
return;
|
||||
Destroy(_containerItem.gameObject);
|
||||
_containerItem = null;
|
||||
OnContainerChanged.Invoke(this, false);
|
||||
_containerItem = null;
|
||||
}
|
||||
|
||||
public ContainerItem GetContainerItem()
|
||||
@@ -155,12 +157,12 @@ public class Player : BaseCharacter
|
||||
|
||||
internal void Learn(TimeSpan time)
|
||||
{
|
||||
ActiveCourse.PlayerProgress+= time.Hours;
|
||||
if(ActiveCourse.PlayerProgress>=ActiveCourse.Duration)
|
||||
ActiveCourse.PlayerProgress += time.Hours;
|
||||
if (ActiveCourse.PlayerProgress >= ActiveCourse.Duration)
|
||||
{
|
||||
Education++;
|
||||
print($"Congratulation player finish curse {ActiveCourse.Description} and his education now {Education.ToString()}");
|
||||
ActiveCourse =null;
|
||||
ActiveCourse = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class CameraSystem : MonoBehaviour
|
||||
|
||||
public void ResetToPlayerPosition()
|
||||
{
|
||||
Renderer[] renderers = FindObjectsOfType<Renderer>();
|
||||
Renderer[] renderers = FindObjectsByType<Renderer>(FindObjectsSortMode.InstanceID);
|
||||
|
||||
_worldBounds = renderers[0].bounds;
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ public class RadialMenuItem : MonoBehaviour
|
||||
private Button _radialMenuItemPrefab;
|
||||
private Dictionary<RadialMenuActions, RadialMenuActionDescription> _actions;
|
||||
private UniTaskCompletionSource<RadialMenuActions> tcs = new UniTaskCompletionSource<RadialMenuActions>();
|
||||
private float _buttonWidth;
|
||||
//private float _buttonWidth;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_buttonWidth = _radialMenuItemPrefab.GetComponent<RectTransform>().rect.width;
|
||||
// _buttonWidth = _radialMenuItemPrefab.GetComponent<RectTransform>().rect.width;
|
||||
}
|
||||
|
||||
public UniTask<RadialMenuActions> ShowButtons(Dictionary<RadialMenuActions, RadialMenuActionDescription> actions)
|
||||
|
||||
@@ -33,9 +33,7 @@ public class UIContainer : MonoBehaviour
|
||||
else
|
||||
{
|
||||
_container.gameObject.SetActive(false);
|
||||
Destroy(_playerContainer);
|
||||
//_playerContainer.OnItemsChange -= OnItemsChange;
|
||||
//_playerContainer = null;
|
||||
_playerContainer.OnItemsChange -= OnItemsChange;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user