protected IEnumerator Deposit_Ore(Vector3Int i_pos)
    {
        Block_Interactable temp_block = vision.Grab_Seen_Interactable(i_pos);

        if (memory.Check_Pos(i_pos) != 2)
        {
            does_nexus_return = false;
            next_state        = Check_Priorities();
            yield break;
        }

        while (temp_block == null)
        {
            Look_At_Point(i_pos);
            temp_block = vision.Grab_Seen_Interactable(i_pos);
            yield return(null);
        }

        inventory.Set_Target(temp_block.Get_Inventory());
        inventory.Give_Item("Copper Ore", 1);
        does_nexus_return = false;

        next_state = Check_Priorities();
        yield return(null);
    }
    protected IEnumerator Build(Vector3Int i_pos)
    {
        if ((inventory.Get_Item_Quantity() >= 1) && (vision.Is_Pos_Seen(i_pos)) && (memory.Check_Pos(i_pos) == 0))
        {
            Block_Interactable temp_block = vision.Grab_Seen_Interactable(i_pos);

            while (!vision.Is_Pos_Seen(i_pos))
            {
                Look_At_Point(i_pos);
                yield return(null);
            }
        }
        else
        {
            does_wall_build = false;
            next_state      = Check_Priorities();
            yield break;
        }

        Build_Wall(i_pos);

        does_wall_build = false;
        next_state      = Check_Priorities();
        yield return(null);
    }
Beispiel #3
0
    // This will scan the AI's vision for the nearest interactable tile and return it
    public Block_Interactable Grab_Nearest_Interactable(Vector3 i_pos)
    {
        float distance = 100.0f;
        Block_Interactable return_interactable = null;

        foreach (var interactable in seen_interactables)
        {
            float current_distance = Vector3.Distance(i_pos, interactable.transform.position);
            if (current_distance < distance)
            {
                return_interactable = interactable;
                distance            = current_distance;
            }
        }
        return(return_interactable);
    }