37 lines
842 B
C#
37 lines
842 B
C#
using UnityEngine;
|
|
using AibisDream.FixSystem;
|
|
using System.Collections.Generic;
|
|
|
|
namespace AibisDream
|
|
{
|
|
public class PowerSource : MonoBehaviour
|
|
{
|
|
public Plug[] plugs; // 插头数组,在Inspector中手动设置
|
|
private CableSystem cableSystem;
|
|
|
|
private void Awake()
|
|
{
|
|
cableSystem = GetComponentInParent<CableSystem>();
|
|
}
|
|
|
|
public bool HasAvailablePlug()
|
|
{
|
|
foreach (var plug in plugs)
|
|
{
|
|
if (plug.IsAvailable)
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public Plug GetAvailablePlug()
|
|
{
|
|
foreach (var plug in plugs)
|
|
{
|
|
if (plug.IsAvailable)
|
|
return plug;
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
} |