Beispiel #1
0
    void AttemptWalk(Vector2Int direction)
    {
        Debug.Log("AttemptWalk " + direction);
        if (direction.y < 0)
        {
            return;
        }

        var targetCell = Player.Cell + direction;

        if (targetCell.X < 0 || targetCell.X >= Level.Def.Width)
        {
            return;
        }

        var targetBlock = Level.GetBlock(targetCell);

        if (targetBlock)
        {
            AttemptDig(direction);
        }
        else
        {
            OnEnergySpent.Invoke(EnergySpendingType.Walk);
            Player.Walker.MoveToCell(targetCell);
        }
    }
Beispiel #2
0
    void AttemptDig(Vector2Int direction)
    {
        var targetCell = Player.Cell + direction;

        if (targetCell.Y > Level.Def.Depth)
        {
            return;
        }

        IsDigging = true;
        var targetBlock = Level.GetBlock(targetCell);

        OnEnergySpent.Invoke(EnergySpendingType.Dig);
        Level.DestroyGroup(targetBlock);
        Invoke("StopDig", .25f);
    }