Ejemplo n.º 1
0
 public void Cast(GChess chess, GFloor floor)
 {
     chess.Teleport(floor.location);
 }
Ejemplo n.º 2
0
    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()));
    }
Ejemplo n.º 3
0
 public override void OnPassFloor(GFloor floor)
 {
     base.OnPassFloor(floor);
     ElementSystem.ApplyElementAtAsync(floor.location, Element.Water);
 }
Ejemplo n.º 4
0
 public void MoveTo(GFloor floor)
 {
     MoveTo(floor.location);
 }
Ejemplo n.º 5
0
 async public UniTask MoveToAsync(GFloor floor)
 {
     await MoveToAsync(floor.location);
 }
Ejemplo n.º 6
0
 public virtual void OnPassFloor(GFloor floor)
 {
 }
Ejemplo n.º 7
0
 public FloorStateMachine(GFloor owner)
 {
     floor = owner;
 }