45 lines
941 B
C#
Raw Normal View History

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