2024-10-23 09:12:15 +08:00

45 lines
941 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Script;
using UnityEngine;
public class WaitSlot : MonoBehaviour
{
public List<Grid> waits => waitGrids;
[SerializeField]
private List<Grid> waitGrids;
private void Awake()
{
foreach (var grid in waitGrids)
{
grid.action = AniEndEvent;
}
}
/// <summary>
/// 判断是否有可移动位置
/// </summary>
/// <param name="mGrid"></param>
/// <returns></returns>
public bool MoveOpen(out Grid mGrid)
{
mGrid = null;
foreach (var grid in waitGrids.Where(grid => grid.passenger==null))
{
mGrid = grid;
return true;
}
return false;
}
/// <summary>
/// 到达等待区域事件
/// </summary>
public void AniEndEvent()
{
GameManager.ins.MoveCarEvent();
}
}