public void LoadData(string dire)
    {
        string te = "";

        te = File.ReadAllText(dire);
        Grid.ClearGrid();

        Debug.Log(dire);
        s_leveldat leveldata = JsonUtility.FromJson <s_leveldat>(te);

        Grid.groundworldsize = leveldata.gridsize;

        load.FeedGridData(leveldata);
        Grid.UnpaintAllNodes();
    }
Example #2
0
    void CleanDebugNodes()
    {
        fringe.Clear();
        closednodes.Clear();
        opennodes.Clear();
        Vector2 gridworld = Grid.gridworldsize;

        for (int x = 0; x < gridworld.x; x++)
        {
            for (int y = 0; y < gridworld.y; y++)
            {
                Grid.UnpaintAllNodes();
            }
        }
    }
Example #3
0
    public void Teleport(s_charactermanager returning_system)
    {
        positon = grid.VectorPositionFromWorld(transform.position);
        Queue <o_node> di = new Queue <o_node>();

        foreach (o_node n in directions)
        {
            di.Enqueue(n);
        }
        Vector2Int newpos = new Vector2Int();

        while (di.Count != 1)
        {
            di.Dequeue();
        }
        transform.position = di.Peek().position;
        newpos             = grid.VectorPositionFromWorld(transform.position);
        grid.character_layer[positon.x, positon.y] = null;
        grid.character_layer[newpos.x, newpos.y]   = this;
        grid.UnpaintAllNodes();
        di.Clear();

        returning_system.LooseFocus();
    }
    public void ConfirmMovement()
    {
        player.actionPoints -= pathfcost;
        pathfcost            = 0;

        if (!IsSkipped)
        {
            STATES = STATEMACHINE.WALK;
            Grid.UnpaintAllNodes();
            StartCoroutine(player.MoveToPosition(this));
        }
        else   //If the player is walking then stop.
        {
            player.Teleport(this);
        }
        //Disable CancelMove and Confirm
    }