Ejemplo n.º 1
0
    public void TilePlaced(Honeycomb tile, bool corrupted)
    {
        var optionLeft = CheckNoOptionLeft();

        if (!optionLeft)
        {
            return;
        }

        // Move Milfs
        MilfController.Instance.MoveMilfs(bee.currentTile);

        if (corrupted)
        {
            //Bee shouldnt move to newly placed corrupted tiles
            return;
        }
        MilfController.Instance.IncreaseMilfCounter();

        var path = PathfinderBeemaker.FindPath(bee.currentTile, TileController.Instance.GetFinishHoneycomb());

        if (path.Count == 0)
        {
            // No Path to finish found, get to target tile
            path = PathfinderBeemaker.FindPath(bee.currentTile, tile);
        }

//        // No path to target found. Be will not move. Check losing condition
//        if (path.Count == 0)
//        {
//            CheckNoOptionLeft();
//        }

        bee.Navigate(path);
    }
Ejemplo n.º 2
0
 public void MoveMilfs(Honeycomb beeCurrentTile)
 {
     Debug.Log($"Moving {spawnedMilfs.Count} milfs");
     // Bee segment
     foreach (var milf in spawnedMilfs)
     {
         var path = PathfinderBeemaker.FindPath(milf.currentTile, beeCurrentTile);
         milf.Navigate(path);
     }
 }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            var test = target as PathfinderTest;

            DrawDefaultInspector();

            if (GUILayout.Button("FindPath")) //10
            {
                Debug.Log(test.from?.number + " to " + test.to?.number);
                var path = PathfinderBeemaker.FindPath(test.from, test.to);

                if (path.Count == 0)
                {
                    Debug.Log("No Path found");
                }
                else
                {
                    var str = string.Join("-", path.Select(x => x.number));
                    Debug.Log(str);
                }
            }
        }