public void Cast(GChess chess, GFloor floor) { chess.Teleport(floor.location); }
public NavInfo GetNavInfo(Vector2Int location, int movement, int teamID = -1) { Queue <ValueTuple <UnityEngine.Vector2Int, int, int> > queue = new Queue <ValueTuple <UnityEngine.Vector2Int, int, int> >(); Queue <Vector2Int> res = new Queue <Vector2Int>(); Queue <int> prev = new Queue <int>(); Queue <bool> occupy = new Queue <bool>(); Vector2Int[] dir = new Vector2Int[] { new Vector2Int(0, 1), new Vector2Int(1, 0), new Vector2Int(0, -1), new Vector2Int(-1, 0) }; queue.Enqueue((location, movement, 0)); res.Enqueue(location); prev.Enqueue(-1); occupy.Enqueue(true); HashSet <Vector2Int> vis = new HashSet <Vector2Int>(); vis.Add(location); while (queue.Count != 0) { var node = queue.Dequeue(); if (node.Item2 <= 0) { continue; } foreach (Vector2Int curDir in dir) { Vector2Int loc = node.Item1 + curDir; if (vis.Contains(loc)) { continue; } else { vis.Add(loc); } GFloor floor = GetFloor(loc); // GChess chess = GetChess(loc); if (!floor || !CheckTransitability(loc)) { continue; } else { queue.Enqueue((loc, node.Item2 - 1, res.Count)); res.Enqueue(loc); prev.Enqueue(node.Item3); occupy.Enqueue(false); //if (!chess) //{ // occupy.Enqueue(false); //} //else //{ // occupy.Enqueue(true); //} } } } return(new NavInfo(res.ToArray(), prev.ToArray(), occupy.ToArray())); }
public override void OnPassFloor(GFloor floor) { base.OnPassFloor(floor); ElementSystem.ApplyElementAtAsync(floor.location, Element.Water); }
public void MoveTo(GFloor floor) { MoveTo(floor.location); }
async public UniTask MoveToAsync(GFloor floor) { await MoveToAsync(floor.location); }
public virtual void OnPassFloor(GFloor floor) { }
public FloorStateMachine(GFloor owner) { floor = owner; }