Beispiel #1
0
    int[] FindFreeAdjacentTile(OnGrid target)
    {
        int tx = target.GridX();
        int ty = target.GridY();

        OnGrid[]          gridObjects = FindObjectsOfType <OnGrid> ();
        GalleryWanderer[] wanderers   = FindObjectsOfType <GalleryWanderer> ();
        for (int dy = -1; dy < 2; dy++)
        {
            for (int dx = -1; dx < 2; dx++)
            {
                if (IsTileFree(tx + dx, ty + dy, gridObjects, wanderers))
                {
                    return(new int[] { tx + dx, ty + dy });
                }
            }
        }

        return(null);
    }
Beispiel #2
0
 // Use this for initialization
 void Start()
 {
     mMyOnGrid     = GetComponent <OnGrid>();
     mGridLogicRef = FindObjectOfType <GridLogic>();
 }