Esempio n. 1
0
 public void FindNeighbors(float jumpHeight, CandiceTile target)
 {
     Reset();
     CheckTile(Vector3.forward, jumpHeight, target);
     CheckTile(-Vector3.forward, jumpHeight, target);
     CheckTile(Vector3.right, jumpHeight, target);
     CheckTile(-Vector3.right, jumpHeight, target);
 }
Esempio n. 2
0
 public void Reset()
 {
     adjacencyList.Clear();
     current    = false;
     target     = false;
     selectable = false;
     visited    = false;
     parent     = null;
     distance   = 0;
     f          = g = h = 0;
 }
Esempio n. 3
0
        public void CheckTile(Vector3 direction, float jumpHeight, CandiceTile target)
        {
            Vector3 halfExtents = new Vector3(0.25f, (1 + jumpHeight) / 2.0f, 0.25f);

            Collider[] colliders = Physics.OverlapBox(transform.position + direction, halfExtents);
            foreach (Collider item in colliders)
            {
                CandiceTile CandiceTile = item.GetComponent <CandiceTile>();
                if (CandiceTile != null && CandiceTile.walkable)
                {
                    RaycastHit hit;
                    if (!Physics.Raycast(CandiceTile.transform.position, Vector3.up, out hit, 1) || (CandiceTile == target))
                    {
                        adjacencyList.Add(CandiceTile);
                    }
                }
            }
        }