BITFALL/Assets/Artists/Scripts/Industry/UnityBatteryDevice.cs

37 lines
881 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BITFALL.Industry
{
public class UnityBatteryDevice : UnityTechDeviceBase<UnityBatteryDevice>,IBatteryDevice
{
[Header(nameof(IBatteryDevice))]
[SerializeField] private int batteryCapacity;
[SerializeField] private int currentBattery;
[SerializeField] private bool allowOutPut;
[SerializeField] private bool allowCharge;
public int BatteryCapacity => batteryCapacity;
public int CurrentBattery
{
get=>currentBattery;
set=>currentBattery=value;
}
public bool AllowOutPut => allowOutPut;
public bool AllowCharge=>allowCharge;
protected override void Start()
{
base.Start();
if(allowOutPut) UnityPowerService.Register(this);
}
protected override void Dispose()
{
base.Dispose();
if(allowOutPut) UnityPowerService.UnRegister(this);
}
}
}