54 lines
1.1 KiB
C#
54 lines
1.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Net.NetworkInformation;
|
|
using BITFALL.Entities;
|
|
using BITKit;
|
|
using BITKit.Entities;
|
|
using BITKit.Entities.Player;
|
|
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
|
|
namespace BITFALL.UX
|
|
{
|
|
public class UXKnockDown : MonoBehaviour
|
|
{
|
|
[SerializeReference, SubclassSelector] private IPlayerService playerService;
|
|
|
|
[SerializeField] private InputActionReference pressureAction;
|
|
|
|
[SerializeReference,SubclassSelector] private IReference prompt;
|
|
|
|
[Inject] private IKnockdown _knockdown;
|
|
[Inject] private IHealth _health;
|
|
|
|
private Entity _entity;
|
|
private void Start()
|
|
{
|
|
playerService.OnPlayerInitialized += OnPlayerInitialized;
|
|
}
|
|
|
|
private void OnPlayerInitialized(Entity obj)
|
|
{
|
|
obj.Inject(this);
|
|
_entity = obj;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (!_entity) return;
|
|
|
|
if (_health.IsAlive && _knockdown is {IsKnockdown:true,IsPressured:false})
|
|
{
|
|
UXOnScreenPrompts.Get(pressureAction.GetKeyMap(),prompt.Value);
|
|
|
|
}
|
|
else
|
|
{
|
|
UXOnScreenPrompts.Release(pressureAction.GetKeyMap(),prompt.Value);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|