Ejemplo n.º 1
0
    public void PaintDig(DestinationMarkerEventArgs args)
    {
        if (!IsDigging)
        {
            return;
        }

        // TODO: improve by using raycast to dig marker height
        Vector3 target = new Vector3(args.destinationPosition.x, DigMarkerWorldPositionY, args.destinationPosition.z);

        LevelTile tile = LevelHelpers.GetTileAtWorldPos(LevelController.Instance.Model, target);

        if (TileIsDiggable(tile))
        {
            if (paintMode == PaintModes.ERASE)
            {
                tile.MarkedForDigging = false;
                MinionManager.Instance.RemoveDigTile(tile);
            }
            else if (paintMode == PaintModes.PAINT)
            {
                tile.MarkedForDigging = true;
                MinionManager.Instance.AddDigTile(tile);
            }

            LevelController.Instance.UpdateTileDigMarker(tile);
        }
    }
Ejemplo n.º 2
0
    public void Dig(DestinationMarkerEventArgs args)
    {
        // TODO: improve by using raycast to dig marker height
        Vector3 target = new Vector3(args.destinationPosition.x, DigMarkerWorldPositionY, args.destinationPosition.z);

        // Debug.LogWarning("START DIG");

        IsDigging = true;

        LevelTile tile = LevelHelpers.GetTileAtWorldPos(LevelController.Instance.Model, target);

        paintMode = tile.MarkedForDigging ? PaintModes.ERASE : PaintModes.PAINT;

        if (TileIsDiggable(tile))
        {
            PaintDig(args);
        }
    }